7 Functions that Return the Current Date in DuckDB

DuckDB provides us with a bunch of functions that we can use to return the current date and/or time. We can get the date in local time or coordinated universal time (UTC), depending on the function we use. These can be useful in a range of scenarios, such logging the current date in a database column, or filtering or comparing dates based on the current date.

The Functions

Here’s a quick overview of each function:

Function/KeywordDescription
current_dateCurrent date (at start of current transaction) in UTC as a DATE value.
today()Current date (start of current transaction) in UTC as a DATE value.
current_localtimestamp()Returns a TIMESTAMP whose GMT bin values correspond to local date and time in the current time zone.
now()Current date and time (start of current transaction) as TIMESTAMPTZ.
transaction_timestamp()Current date and time (start of current transaction) as TIMESTAMPTZ.
current_timestampCurrent date and time (start of current transaction) as TIMESTAMPTZ.
get_current_timestamp()Current date and time (start of current transaction) as TIMESTAMPTZ.

Here’s an example of all of these functions in a single query:

SELECT
    current_date,
    today(),
    current_localtimestamp(),
    now(),
    transaction_timestamp(),
    current_timestamp,
    get_current_timestamp();

Output:

+--------------+------------+--------------------------+----------------------------+----------------------------+----------------------------+----------------------------+
| current_date | today() | current_localtimestamp() | now() | transaction_timestamp() | current_timestamp | get_current_timestamp() |
+--------------+------------+--------------------------+----------------------------+----------------------------+----------------------------+----------------------------+
| 2025-02-13 | 2025-02-13 | 2025-02-14 07:42:57.172 | 2025-02-14 07:42:57.172+10 | 2025-02-14 07:42:57.172+10 | 2025-02-14 07:42:57.172+10 | 2025-02-14 07:42:57.172+10 |
+--------------+------------+--------------------------+----------------------------+----------------------------+----------------------------+----------------------------+

Here’s the result in vertical output (which may make it easier to compare the output of each function):

            current_date = 2025-02-13
today() = 2025-02-13
current_localtimestamp() = 2025-02-14 07:42:34.465
now() = 2025-02-14 07:42:34.465+10
transaction_timestamp() = 2025-02-14 07:42:34.465+10
current_timestamp = 2025-02-14 07:42:34.465+10
get_current_timestamp() = 2025-02-14 07:42:34.465+10

Below is a closer look at each function. I’ll also pass each function to the typeof() function so that we can see the return data type.

The current_date Function

The current_date function returns the current date as a DATE type. More specifically, it returns the current date at start of current transaction in UTC.

This function doesn’t require parentheses, which makes its syntax a bit different to most other built-in functions. But we can use parentheses if we wish. Here’s an example that uses both forms:

SELECT 
    current_date,
    typeof(current_date),
    current_date(),
    typeof(current_date());

Result:

+--------------+----------------------+----------------+------------------------+
| current_date | typeof(current_date) | current_date() | typeof(current_date()) |
+--------------+----------------------+----------------+------------------------+
| 2025-02-13 | DATE | 2025-02-13 | DATE |
+--------------+----------------------+----------------+------------------------+

Also, the typeof() function tells us that the result is returned as a DATE value.

The today() Function

The today() function does the same thing as current_date; it returns the current date at start of current transaction in UTC as a DATE value.

However, with the today() function, we must use parentheses:

SELECT 
    today(),
    typeof(today());

Result:

+------------+-----------------+
| today() | typeof(today()) |
+------------+-----------------+
| 2025-02-13 | DATE |
+------------+-----------------+

The current_localtimestamp() Function

The current_localtimestamp() function returns a TIMESTAMP whose GMT bin values correspond to local date and time in the current time zone:

SELECT 
    current_localtimestamp(),
    typeof(current_localtimestamp());

Result:

+--------------------------+----------------------------------+
| current_localtimestamp() | typeof(current_localtimestamp()) |
+--------------------------+----------------------------------+
| 2025-02-14 08:41:55.393 | TIMESTAMP |
+--------------------------+----------------------------------+

This function requires parentheses.

The now() Function

The now() function returns the current date and time (start of current transaction) as TIMESTAMPTZ (otherwise known as TIMESTAMP WITH TIME ZONE):

SELECT 
    now(),
    typeof(now());

Result:

+----------------------------+--------------------------+
| now() | typeof(now()) |
+----------------------------+--------------------------+
| 2025-02-14 08:40:00.487+10 | TIMESTAMP WITH TIME ZONE |
+----------------------------+--------------------------+

This function requires parentheses.

The transaction_timestamp() Function

The transaction_timestamp() function returns the current date and time (start of current transaction) as TIMESTAMPTZ:

SELECT 
    transaction_timestamp(),
    typeof(transaction_timestamp());

Result:

+---------------------------+---------------------------------+
| transaction_timestamp() | typeof(transaction_timestamp()) |
+---------------------------+---------------------------------+
| 2025-02-14 08:39:32.39+10 | TIMESTAMP WITH TIME ZONE |
+---------------------------+---------------------------------+

This function requires parentheses.

The current_timestamp Function

The current_timestamp function returns the current date and time (start of current transaction) as TIMESTAMPTZ:

SELECT 
    current_timestamp,
    typeof(current_timestamp);

Result:

+---------------------------+---------------------------+
| current_timestamp | typeof(current_timestamp) |
+---------------------------+---------------------------+
| 2025-02-14 08:37:44.25+10 | TIMESTAMP WITH TIME ZONE |
+---------------------------+---------------------------+

This function doesn’t accept parentheses.

The get_current_timestamp() Function

The get_current_timestamp() function returns the current date and time (start of current transaction) as a TIMESTAMPTZ:

SELECT 
    get_current_timestamp(),
    typeof(get_current_timestamp());

Result:

+----------------------------+---------------------------------+
| get_current_timestamp() | typeof(get_current_timestamp()) |
+----------------------------+---------------------------------+
| 2025-02-14 08:37:01.648+10 | TIMESTAMP WITH TIME ZONE |
+----------------------------+---------------------------------+