calendar-names: Calendar Names

calendar-namesR Documentation

Calendar Names

Description

These three functions return (abbreviated and full) names of months and days of week as well as AM/PM indicators in the current or user-provided locale.

How the month and weekday names are actually returned depends both on the selected locale and character set / code page setting.

Usage

month_names(locale = NULL, abbreviate = TRUE)

weekday_names(locale = NULL, abbreviate = TRUE)

ampm_indicators(locale = NULL)

Arguments

locale

a character value determining locale or NULL (default, interpreted as the current system locale).

abbreviate

a logical value, if TRUE, abbreviated names are returned; if FALSE, full names are returned. TRUE by default.

Value

A character vector of length 12, 7, or 2.

Locale Settings

Unfortunately, locale and character set naming were not standardised across different operating systems for many years. On modern operating systems, however, locale is usually of the form xx_XX (xx for language, XX for country) optionally followed by a dot and a character set identifier, for example, UTF-8.

"C" is a special locale that should always be available and defaults to American English.

See Also

format for formatting objects of tind class.

Examples

# current system locale
month_names()
weekday_names()
try(
ampm_indicators()
)

try({
# English abbreviated month names
print(month_names("en_GB"))
# French month names
print(month_names("fr_FR.UTF-8", FALSE))
# German abbreviated month names
print(month_names("de_DE.UTF-8"))
# Polish abbreviated month names
print(month_names("pl_PL.UTF-8"))
# English weekday names
print(weekday_names("en_GB", FALSE))
# French abbreviated weekday names
print(weekday_names("fr_FR.UTF-8"))
# German weekday names
print(weekday_names("de_DE.UTF-8", FALSE))
# Polish abbreviated weekday names
print(weekday_names("pl_PL.UTF-8"))
# US am/pm indicators
print(ampm_indicators("en_US"))
# UK am/pm indicators
print(ampm_indicators("en_GB"))
})


tind documentation built on Dec. 28, 2025, 1:06 a.m.