Cloud

current_timestamp

The current_timestamp() returns the current timestamp value representing the date and time the query was executed.

Note that the time returned by this function is the time when the query was executed.

Syntax

CURRENT_TIMESTAMP
CURRENT_TIMESTAMP()
CURRENT_TIMESTAMP(precision)

Arguments

  • precision: Optional. An integer literal from 0 to 6 that controls how many fractional-second digits to include. When omitted, the function returns full microsecond precision (6 digits).

Examples

Default precision

This example returns the current date and time with full microsecond precision:

SELECT CURRENT_TIMESTAMP AS "Current Time";

The final result will display the current date and time in the timezone in which it was issued:

-----------------------------
 Current Time
-----------------------------
 2022-08-31 16:56:06.464016
-----------------------------

Truncated precision

This example returns the current timestamp with no fractional seconds:

SELECT CURRENT_TIMESTAMP(0) AS "Current Time";
---------------------
 Current Time
---------------------
 2022-08-31 16:56:06
---------------------