Skip to contents

The flex_d_lst object is a list of widely supported flexible date types. Flexible date types are classes of date formatting which can be translated across locales. There are 26 flexible date types in flex_d_lst.

Usage

flex_d_lst

Format

An object of class list of length 26.

Value

A list where each element corresponds to a classifier for a flexible date type.

Examples

The flex_d_lst object can be incredibly useful when you need to get a format for date formatting that works across all locales. You can avoid typing errors by using this list and every flexible date type from this list is guaranteed to work across all supported locales. In this example, we'll use the "yMMMEd" flexible date type by accessing it from the flex_d_lst object.

fdt(
  input = "2018-07-04 22:05",
  format = flex_d_lst$yMMMEd,
  locale = "en"
)

#> [1] "Wed, Jul 4, 2018"

If we wanted this in a different locale, the locale-specific format pattern behind the flexible date identifier would ensure consistency while moving to that locale. Let's use the fdt_locales_lst object in the same spirit to specify the French (Canada) locale.

fdt(
  input = "2018-07-04 22:05",
  format = flex_d_lst$yMMMEd,
  locale = fdt_locales_lst$fr_CA
)

#> [1] "mer. 4 juill. 2018"