Date.DayOfWeek

Date.DayOfWeek

Returns a number from 1 to 7 representing the day of the week.

function (optional dateTime as nullable any, optional firstDayOfWeek as nullable any) as nullable any

Description

Returns a number between 0 and 6 representing the day of the week in the provided datetime value dateTime. This function takes an optional Day value, firstDayOfWeek, to set the first day of the week for this relative calculation. The default value firstDay is Day.Sunday. Valid values are: Day.Sunday, Day.Monday, Day.Tuesday, Day.Wednesday, Day.Thursday, Day.Friday, and Day.Saturday.

Category

Date

Examples

Get which the day of the week February 21st, 2011 falls on, with (default) Sunday being the first day of the week.

Date.DayOfWeek(#date(2011, 02, 21))

1

Get which day of the week February 21st, 2011 falls on, with Monday being the first day of the week.

Date.DayOfWeek(#date(2011, 02, 21), Day.Monday)

0