Link Search Menu Expand Document

CURRENT_PGDATE (legacy)

You are looking at legacy documentation for Firebolt’s deprecated date and timestamp type functions. New types were introduced in DB version 3.19 under the names PGDATE and TIMESTAMPNTZ, and made generally available in DB version 3.22.

If you worked with Firebolt before DB version 3.22, you might still be using the legacy date and timestamp types. Determine which types you are using by executing the query SELECT EXTRACT(CENTURY FROM DATE '2023-03-16');. If this query returns an error, you are still using the legacy date and timestamp types and can continue with this documentation, or find instructions to use the new types here. If this query returns a result, you are already using the redesigned date and timestamp types and can use this function under the name CURRENT_DATE().

Returns the current (local) date in the time zone specified in the session’s time_zone setting.

Syntax

The function can be called with or without parentheses:

CURRENT_DATE
CURRENT_DATE()

Return Type

DATE

Remarks

The function takes the current Unix timestamp (in the UTC time zone), converts it to the time zone specified in the time_zone setting, extracts the date part, and returns it as a DATE value. Two simultaneous calls of the function can return different dates, due to time zone conversion.

Example

The following example assumes that the current Unix timestamp is 2023-03-03 23:59:00 UTC. Observe how we return different dates with different time zone settings:

SET time_zone = 'Europe/Berlin';
SELECT CURRENT_DATE;  --> 2023-03-04

SET time_zone = 'America/New_York';
SELECT CURRENT_DATE;  --> 2023-03-03