fmt_date_time: Get a localized date, time, or date-time string in a standard...

Description Usage Arguments

View source: R/fmt_date_time.R

Description

Get a localized date, time, or date-time string in a standard form.

Usage

1
2
fmt_date_time(input, date_format = NULL, time_format = NULL,
  combination = NULL, locale = NULL)

Arguments

input

the input date-time. The appropriate representation should use the following construction outlined in the ISO 8601:2004 standard: YYYY-MM-DDThh:mm:ss.sTZD although some allowances made here to ease this restrictiveness (for example, the literal T separating the date and time components is optional). Fractional seconds are optional as is the time-zone designation (TZD).

date_format

a date format specification using the rules of the SimpleDateFormat. The helper function fdf() could be used with a predefined format name or format number. The information function info_fdf_types() provides information on which date formatting presets are available and includes output samples for each of them.

time_format

a time format specification using the rules of the SimpleDateFormat. There are two useful helper functions to use 12-hour and 24-hour preset formats: ftf_12() and ftf_24(). Either could be used with a predefined format name or format number. The information functions info_ftf_12_types() and info_ftf_24_types() both provide information on which 12-hour and 24-hour time formatting presets are available. They also include output samples for each time preset.

combination

a combining pattern for the localized date and time components. If this is not provided, then the combining pattern will come from the specified locale's "full" designation. If there is neither a combination nor a locale provided, then the time component will follow the date after a space character. If providing a pattern, the string should be composed with the {0} and {1} placeholders, representing time and date components, respectively. All other characters are taken to be string literals.

locale

an optional output locale to use for formatting the input value according to the specified locale's rules. Example locale names include "en_US" for English (United States) and "fr_FR" for French (France). If a locale isn't provided and certain require locale- based formatting then the "en_US" locale is used for this purpose.


rich-iannone/i18n documentation built on Sept. 23, 2018, 12:56 a.m.