Skip to contents

Get the weekday name of a date

Usage

get_weekday_name(date, format = "%Y-%m-%d", lang = NULL)

Arguments

date

either a character or a Date 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 is NULL (i.e. use the current locale). See examples below. Depending on the OS and the locale, the output can be weird.

Value

A character of length 1.

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")
}