Learn R Programming

surveillance (version 1.23.1)

formatDate: Convert Dates to Character (Including Quarter Strings)

Description

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

Usage

formatDate(x, format)

Value

a character vector representing the input date(s) x

following the format specification.

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

See Also

Examples

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

Run the code above in your browser using DataLab