Skip to contents

Get the POSIX standard date formats from character text formats.

Usage

getFormat(
  date,
  char.format = c("MM.DD.YYYY", "MMM.DD.YYYY", "DD.MM.YYYY", "DD.MMM.YYYY", "YYYY.MM.DD",
    "YYYY.MMM.DD"),
  sep = ""
)

Arguments

date

character string of date

char.format

character text format of date

sep

character string separating date

Value

A character string representing the POSIX standard date format equivalent of the string in char.format.

See also

Other date formatting functions: chr_to_date(), cleanDate(), formatDate(), numericToDate()

Author

Derek Chiu

Examples

getFormat("12/09/1993", "MM.DD.YYYY")
#> [1] "%m/%d/%Y"
getFormat("2005-09-13", "YYYY.MM.DD")
#> [1] "%Y-%m-%d"