Categories:

Context Functions (General)

LOCALTIME

Returns the current time for the system.

ANSI-compliant alias for CURRENT_TIME.

Syntax

LOCALTIME()

LOCALTIME
Copy

Arguments

None.

Returns

Returns a value of type TIME.

Usage notes

  • The setting of the TIMEZONE parameter affects the return value. The returned time is in the time zone for the session.

  • The display format for times in the output is determined by the TIME_OUTPUT_FORMAT session parameter (default HH24:MI:SS).

  • To comply with the ANSI standard, this function can be called without parentheses.

  • Do not use the returned value for precise time ordering between concurrent queries (processed by the same virtual warehouse) because the queries might be serviced by different compute resources (in the warehouse).

Examples

Show the current local time and local timestamp:

SELECT LOCALTIME(), LOCALTIMESTAMP();
Copy
+-------------+-------------------------------+
| LOCALTIME() | LOCALTIMESTAMP()              |
|-------------+-------------------------------|
| 15:32:45    | 2024-04-17 15:32:45.775 -0700 |
+-------------+-------------------------------+