Skip to main content

Date.StartOfWeek

Returns the start of the week.

Syntax

Date.StartOfWeek(
dateTime as any,
optional firstDayOfWeek as Day.Type
) as any

Remarks

Returns the start of the week that contains dateTime. dateTime must be a date, datetime, or datetimezone value.

Examples

Example #1

Find the start of the week for Tuesday, October 11th, 2011.

Date.StartOfWeek(#datetime(2011, 10, 11, 8, 10, 32))

Result:

// Sunday, October 9th, 2011
#datetime(2011, 10, 9, 0, 0, 0)

Example #2

Find the start of the week for Tuesday, October 11th, 2011, using Monday as the start of the week.

Date.StartOfWeek(#datetime(2011, 10, 11, 8, 10, 32), Day.Monday)

Result:

// Monday, October 10th, 2011
#datetime(2011, 10, 10, 0, 0, 0)

Category

Date