Skip to main content

FirstOfQuarter

The FirstOfQuarter function returns the date and time representing the first day of the quarter.

Prototype

    FirstOfQuarter(Date ; Quarter ; Year)

Arguments

    Date      Date      By value

(optional)
A valid Date. Argument can be a result of an expression or a variable (Studio only).
If Date is not passed, the current time (UTC) will be used.

Quarter String By value

A valid string indicating the quarter you want to get the date.
Argument can be a literal, the result of an expression or a variable (Studio only).
Accepted values are according the below quarter parameter table.

Year String By value

(Optional)
A valid string indicating the year of the quarter you want to get the date.
Argument can be a literal, the result of an expression or a variable (Studio only).
Accepted values are according the below Year parameter table.
If not specfied, then the year of the Date parameter is used.

Returns

    Date

The date and time representing the first day of the quarter.

Exception

    Undefined

Undefined is returned if Date is Undefined or is not a Date.

Undefined is returned if PrevNext or Quarter contains an invalid value.

Quarter parameter

ValueDescription
'Previous' or 'p'Previous quarter
'Current' or 'c'Current quarter
'Next' or 'n'Next quarter
'Q1' or 'q1'First quarter
'Q2' or 'q2'Second quarter
'Q3' or 'q3'Third quarter
'Q4' or 'q4'Fourth quarter

Year parameter

ValueDescription
'Previous' or 'p'Previous year
'Current' or 'c'Current year
'Next' or 'n'Next year

Example 

  FirstOfQuarter(; 'Q2' )

This will return the first day of the second quarter of the current year.

  FirstOfQuarter(Date(22022;'';'SFHub') ; 'Q3' )

This will return [July 1st 2022 0:0:0] as UTC in the SFHub time zone.

  FirstOfQuarter(Date(22022;''); 'Q2' ; 'p')

This will return [April 1st 2021 0:0:0] as UTC.