Skip to main content

FirstOfYear

The FirstOfYear function returns the date and time representing the first day of the year.

Prototype

    FirstOfYear(Date; PrevNext)

Arguments

    Date        Date       By value  

(Optional)
A valid Date. The argument can be a literal, the result of an expression or a variable (Studio only) that evaluates a Date.
If date is not passed, the current time (UTC) will be used.

PrevNext String By value

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

Optionally, the PrevNext argument can also contain the number of the year.

Returns

    Date

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

Exception

    Undefined

Undefined is returned if:

- Date1 is Underfined or is not a Date

- if PrevNext contains and invalid value.

PrevNext parameter

ValueDescription
'Previous' or 'p'Get the previous year (January 1st)
'Current' or 'c'Get the current year (January 1st)
'Next' or 'n'Get the next year (January 1st)
'YYYY'A string value containing the year you want to get January 1st
YYYYA numeric value representing the year you want to get January 1st

Example 

  FirstOfYear( ; 'p' )

This will return the first day of the previous year.

  FirstOfYear( ; '2019' )

This will return [January 1st 2019 0:0:0] as UTC.