phrase_datetime: Phrase date(time)s

phrase_datetimeR Documentation

Phrase date(time)s

Description

Formats date(time)s as strings according to the specified formats and locale, applying some typographic tweaks. A convenience wrapper around stringi::stri_datetime_format().

Usage

phrase_datetime(
  x,
  format = "date_long",
  locale = pal::pkg_config_val("locale")
)

Arguments

x

Date(s) or datetime(s) to format. A date, datetime, factor or character vector.

format

Format string(s) defining how to phrase x. Possible values include "date_short", "date_medium", "date_long", "date_full", "time_short", "time_medium", "time_long" and "time_full". See stringi::stri_datetime_format() for details.

locale

NULL or '' for the default locale, or a single string with locale identifier; a non-Gregorian calendar may be specified by setting the @calendar=name keyword

Value

A character vector of the same length as x.

See Also

Other spoken language functions: add_definite_article_de(), decline_noun_de(), definite_article_de(), definite_article_de_declined(), n_ify(), prettify_date(), prettify_datetime(), rank_nr(), write_out_n()

Examples

salim::phrase_datetime(lubridate::today())

salim::phrase_datetime(x = c(lubridate::today(),
                             lubridate::now()),
                       format = c("date_full",
                                  "time_full"),
                       locale = "de-CH")

salim-b/salim documentation built on Dec. 16, 2024, 11 a.m.