formatDate function

Convert Dates to Character (Including Quarter Strings)

Convert Dates to Character (Including Quarter Strings)

An extension of format.Date with additional formatting strings for quarters. Used by linelist2sts.

formatDate(x, format)

Arguments

  • x: a "Date" object.

  • format: a character string, see strftime for possible specifications. Further to these base formats, formatDate

    implements:

    • "%Q": the quarter as a numeric
    • "%OQ": the quarter as a roman numeral
    • "%q": the day within the quarter

Returns

a character vector representing the input date(s) x

following the format specification.

See Also

strftime

Examples

formatDate(as.Date("2021-10-13"), "%G/%OQ/%q")