Begin-of Date Function Calls

Last modified: August 27, 2024

Introduction

Begin-of date function calls calculate the beginning of the day, week, month, or year and return the value.

The first parameter can be an attribute of an entity of type Date and time, a variable of type Date and time, or a Date and time value created using a Date Creation function.

You can also calculate the end of a time period from the specified date. For more information, see End-of Date Function Calls.

beginOfDay

The beginOfDay function calculates the beginning of the day compared to the initial date.

Input Parameters

The input parameters are described in the table below:

Value Type
Initial date Date and time

Output

The output is described in the table below:

Value Type
A Date and time value that is the beginning of the day relative to the initial date. Date and time

Example

If you use the following input:

beginOfDay(dateTime(2007, 2, 7, 1, 1))

The output is:

"Wed Feb 07 00:00 CET 2007"

beginOfWeek

The beginOfWeek function calculates the beginning of the week compared to the initial date. The beginning and the end of the week are based on the user’s locale. In the case of an anonymous user, the browser’s locale is used instead.

Input Parameters

Input parameters are described in the table below:

Value Type
Initial date Date and time

Output

The output is described in the table below:

Value Type
A Date and time value that is the beginning of the week relative to the initial date. Date and time

Example

If you use the following input:

beginOfWeek(dateTime(2007, 2, 7, 1, 1))

The output is:

"Sun Feb 04 00:00 CET 2007"

beginOfMonth

The beginOfMonth function calculates the beginning of the month compared to the initial date.

Input Parameters

The input parameters are described in the table below:

Value Type
Initial date Date and time

Output

The output is described in the table below:

Value Type
A Date and time value that is the beginning of the month relative to the initial date. Date and time

Example

If you use the following input:

beginOfMonth(dateTime(2007, 2, 7, 1, 1))

The output is:

"Thu Feb 01 00:00 CET 2007"

beginOfYear

The beginOfYear function calculates the beginning of the year compared to the initial date.

Input Parameters

The input parameters are described in the table below:

Value Type
Initial date Date and time

Output

The output is described in the table below:

Value Type
A Date and time value that is the beginning of the year relative to the initial date. Date and time

Example

If you use the following input:

beginOfYear(dateTime(2007, 2, 7, 1, 1))

The output is:

"Mon Jan 01 00:00 CET 2007"

Read More