utDayOfWeek {udunits}R Documentation

Convert Date to Day of Week

Description

Converts a calendar date (in the Gregorian calendar) to a day of the week.

Usage

 utDayOfWeek( year, month, day, aschar=FALSE )

Arguments

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)

Details

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).

Value

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.

Note

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.

Author(s)

Implemented by David W. Pierce dpierce@ucsd.edu

See Also

utInit, utScan, utCalendar, utInvCalendar, utFormatDate, utIsTime, utHasOrigin, utConvert

Examples

# What day did the beginning of year 2000 fall on?
utDayOfWeek(2000,1,1,aschar=TRUE)

[Package udunits version 1.3 Index]