Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Determine the Weekday on a Specific Date in R Programming – weekdays() Function

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

weekdays() function in R Language is used to determine the weekday on a specific date passed to it as argument.

Syntax: weekdays(date, abbreviate)

Parameters:
date: Date to be checked
abbreviate: Boolean value to abbreviate weekday

Example 1:




# R program to find the weekday 
# on a specific date
  
# Specifying the date
date <- as.POSIXlt("2020-06-23")
date
  
# Calling weekdays() function
weekdays(date)

Output:

[1] "2020-06-23 UTC"
[1] "Tuesday"

Example 2:




# R program to find the weekday 
# on a specific date
  
# Specifying the date
date <- as.POSIXlt("1994-06-17")
date
  
# Calling weekdays() function
weekdays(date, abbreviate = TRUE)

Output:

[1] "1994-06-17 UTC"
[1] "Fri"
My Personal Notes arrow_drop_up
Last Updated : 24 Jun, 2020
Like Article
Save Article
Similar Reads