RAD function: dayofweek

A RAD function that returns the day of the week for a date, regardless of the date format. The dayofweek function returns 1-7, where 1 is Monday, 2 is Tuesday, 3 is Wednesday, 4 is Thursday, 5 is Friday, 6 is Saturday, and 7 is Sunday.

Function

dayofweek

Format

day=dayofweek($date)

Where the value of $date is a date and time value.

Factors

The set.timezone function affects the way a date is presented, whereas the dayofweek function always extracts the proper day of week value.

Examples

From the RAD debugger type:

d dayofweek(‘11/06/09’)

This expression displays the day of the week of a specific date. (The command d stands for ’display.’) In this example, the value of dayofweek is 5 or Friday.

From the RAD debugger type:

x $Ltoday=dayofweek(‘11/06/09’)

This expression executes the function. (The command x stands for ’execute.’) In this example, you want to assign the value to a variable.