Investment Studio > Expressions > Functions > Date & Time > WEEKDAY

integer weekday(date serial_number, integer return_type = 1)

Returns the day of week encoded in serial_number. The result is an integer. Its range and interpretation depends on the specified return_type:

return_type Interpretation
1 1 = Sunday, 2 = Monday, 3 = Tuesday, 4 = Wednesday, 5 = Thursday, 6 = Friday, 7 = Saturday
2 1 = Monday, 2 = Tuesday, 3 = Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday, 7 = Sunday
3 0 = Monday, 1 = Tuesday, 2 = Wednesday, 3 = Thursday, 4 = Friday, 5 = Saturday, 6 = Sunday

If omitted, return_type defaults to 1 (US-style weekday numbering).

Automatic type conversion allows the use of a date string as argument instead of an explicit date value.

Example

=weekday(35961)

and (assuming standard US date format settings)

=weekday("6/15/1998")

both equal 2 (= Monday).

See also date, datevalue, month, now, timevalue, today, year.