Date.EndOfWeek

Date.EndOfWeek

Returns the last day of the week.

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

Description

Returns the last day of the week in the provided date, datetime, or datetimezone dateTime. This function takes an optional Day, firstDayOfWeek, to set the first day of the week for this relative calculation. The default value is Day.Sunday.

Category

Date

Examples

Get the end of the week for 5/14/2011.

Date.EndOfWeek(#date(2011, 5, 14))

date(2011, 5, 14)

Get the end of the week for 5/17/2011 05:00:00 PM -7:00, with Sunday as the first day of the week.

Date.EndOfWeek(#datetimezone(2011, 5, 17, 5, 0, 0, -7, 0), Day.Sunday)

datetimezone(2011, 5, 21, 23, 59, 59.9999999, -7, 0)