utDayOfWeek {udunits} | R Documentation |
Converts a calendar date (in the Gregorian calendar) to a day of the week.
utDayOfWeek( year, month, day, aschar=FALSE )
year |
Integer 4-digit year to convert (Gregorian calendar only, i.e., year >1752) |
month |
Integer month to convert, 1=Jan, 12=Dec |
day |
Integer day of month to convert, 1-31 |
aschar |
If TRUE, returns the 3-letter abbreviation of the day's name instead of integer (1=Mon, 7=Sun) |
This function computes the day of week for a given date. Only Gregorian calendars are supported, which means only dates after 1752 or so (depending on what country you live in; different countries switched to the Gregorian calendar at different times).
If aschar=FALSE (the default), returns a integer between 1 and 7, with 1=Monday, 7=Sunday. If aschar=TRUE, returns the 3-letter abbreviation of the day's name.
Don't think that this routine works for dates during the 1700's when countries were switching between the Julian and Gregorian calendars; it doesn't.
Implemented by David W. Pierce dpierce@ucsd.edu
utInit
, utScan
,
utCalendar
, utInvCalendar
,
utFormatDate
, utIsTime
,
utHasOrigin
, utConvert
# What day did the beginning of year 2000 fall on? utDayOfWeek(2000,1,1,aschar=TRUE)