Get the weekday name of a date
Arguments
- date
either a
character
or aDate
of length 1. The date to extract the weekday name. See examples below.- format
a
character
of length 1. Used to specify the format of the date. Default is"%Y-%m-%d"
(i.e. 2024-12-25). See examples below.- lang
a
character
of length 1. Used to change the default locale (i.e. the language). Default isNULL
(i.e. use the current locale). See examples below. Depending on the OS and the locale, the output can be weird.
Examples
## Default ----
get_weekday_name("2024-04-01")
#> [1] "Monday"
## Change date format ----
get_weekday_name("01/04/2024", format = "%d/%m/%Y")
#> [1] "Monday"
if (FALSE) {
## Get Spanish name ----
get_weekday_name("2024-04-01", lang = "Spanish")
## Get Finnish name ----
get_weekday_name("2024-04-01", lang = "Finnish")
}