Skip to contents

The Main Function: fdt()

The fdt() function is the one that takes in your date/time/datetime (in whichever way you want to provide it) and provides ways to format that input in a flexible manner.

fdt()
Format a datetime with a formatting string

Locales

You have the option to format dates times according to a specified locale, and there are hundreds of locales. The vector object fdt_locales_vec contains the locale IDs that accepted by fdt() and the fdt_locales_lst list makes selecting a locale in fdt() much more convenient (e.g., locale = fdt_locales_lst$nl_BE).

fdt_locales_lst
A list of all supported locales
fdt_locales_vec()
Get a vector of all supported locales

Flexible Dates and Times

Flexible dates and times (divided into 12- and 24-hour variants) embody the idea of canonical forms that are translated faithfully across many different locales. The vector objects (*_vec) show which of these forms are available and the list objects (*_lst) can be directly used to form an input value for fdt()’s format argument (e.g., format = flex_t24_lst$Hms).

flex_d_lst
A list of all flexible date types
flex_d_vec()
Get a vector of all flexible date types
flex_t24_lst
A list of all 24-hour flexible time types
flex_t24_vec()
Get a vector of all 24-hour flexible time types
flex_t12_lst
A list of all 12-hour flexible time types
flex_t12_vec()
Get a vector of all 12-hour flexible time types

Standard Dates and Times

Standard dates and times follow the convention of four different types (“short”, “medium”, “long”, and “full”) that are specially formulated for each and every locale. These helper functions provide a simple interface for choosing a standardized formatting pattern. Invoke any one of them as an input value for fdt()’s format argument (e.g., format = standard_date_time(type = "medium")).

standard_date_time()
Obtain a standard datetime format that works across locales
standard_date()
Obtain a standard date format that works across locales
standard_time()
Obtain a standard time format that works across locales

Useful Day and Month Vectors

Sometimes you need to know things about days of the week and months (like, their short names). We can get information like that with the names_wkdays(), names_months(), and first_day_of_week() functions.

names_wkdays()
Get a vector of all the short weekday names
names_months()
Get a vector of all the short month names
first_day_of_week()
Get a named vector of all first-day-of-the-week names for different regions