BEGINNING_OF_WEEK
Tom Azernour avatar
Written by Tom Azernour
Updated over a week ago

Type: Function

Function: BEGINNING_OF_WEEK

Syntax: BEGINNING_OF_WEEK(datetime)

Description: Returns a datetime corresponding to the beginning of week (Monday) for the provided datetime or NOW if no value is provided.

Sample usage:

  • BEGINNING_OF_WEEK(created_at) returns the created_at field value set at midnight on the first day of the week. If created_at is equal to 2023-02-23T15:39:21Z then BEGINNING_OF_WEEK(created_at) returns 2023-02-20T00:00:00Z.

  • BEGINNING_OF_WEEK() is equivalent to BEGINNING_OF_WEEK(NOW())

  • BEGINNING_OF_WEEK(DATE(2023, 3, 15)) is equal to DATE(2023, 3, 13)

Did this answer your question?