Views:

Description

Returns the first day of the week given a date.

Uses the localeid of the executing user to determine the first day of the week,

You can find out a users localeid by looking at the usersettings table in Dataverse.

Signature

GetFirstDayOfWeek('datetime', [localeid])

 

Example 1

GetFirstDayOfWeek('09/09/2015') Returns 06/09/2015. Assumes the executing user has the localeid of 1033, which is English - United States.

Example 2

GetFirstDayOfWeek('09/09/2015', 2057) Returns 07/09/2015. (2057 = English - United Kingdom)

 

Note 1

The internal workings of this function uses the CultureInfo class in .NET to make the following call involved in the calculation.

    cultureInfo.DateTimeFormat.FirstDayOfWeek;

https://learn.microsoft.com/en-us/dotnet/api/system.globalization.datetimeformatinfo.firstdayofweek?view=netframework-4.5.2

Parameters

NameTypeDescriptionRequired
datetimexxxxxxxxxxxx