TODAY
The function TODAY returns a Date corresponding with the date the function was called.
This function requires no input. It returns a Date indicating the date at the time the function was called. By default, the date will be in the UTC timezone, though TODAY also accepts an optional input string specifying the timezone of the output; if this is provided, TODAY will return the date in the specified timezone.
Declaration
Parameters
time_zone (optional, type: string, default: UTC)
A string representation of the timezone. TZ Database Names are the timezone representations TODAY is able to parse.
Return Values
today (type: Date)
The present date.
Examples
Due to the very nature of the TODAY function, it will return different output depending on when it is called. For the sake of demonstration, imagine all of the following examples were executed at 10:30 PM (or 22:30 in military time) UTC on April 20, 2021.
The following example returns the date in UTC. Note that no input is given to the TODAY function; UTC is the default timezone:
The Antarctica/Syowa timezone is three hours ahead of UTC. At 10:30 PM UTC, it is already early morning in the Antarctica/Syowa timezone. The following example requests the date in the Antarctica/Syowa timezone. Note that it outputs a Date a day ahead of the previous example, even though, according to our hypothetical, both functions were called at the exact same time:
Last updated