TIMESTAMP
TIMESTAMP (also known as TIMESTAMP_LTZ, Local Time Zone) is a timezone-aware timestamp type with microsecond precision. All operations execute in the current session's timezone, and output is based on the service's timezone (UTC+8 by default).
If you do not need timezone awareness, use TIMESTAMP_NTZ (timezone-free timestamp).
Syntax
Both are equivalent and represent a timestamp with local timezone.
Precision and Storage
| Attribute | Value |
|---|---|
| Precision | Up to microseconds (μs) |
| Timezone | Local timezone (LTZ) |
Actual precision depends on the timestamp precision at write time; microsecond positions are typically stored as milliseconds in the current version.
Literal Syntax
Type Conversion
String to TIMESTAMP
Multiple input formats are supported and automatically recognized:
Integer (Unix Timestamp in Seconds) to TIMESTAMP
TIMESTAMP to Other Types
Common Functions
NULL Handling
Notes
- TIMESTAMP is timezone-aware; writes and reads are affected by the current session timezone. Use
TIMESTAMP_NTZwhen timezone awareness is not needed. - The
Zin ISO 8601 format indicates UTC; it is converted to the current session timezone for display. CURRENT_TIMESTAMP()is a non-deterministic function and cannot be used as a timestamp argument forTABLE_CHANGES(a literal is required).- Timestamp subtraction returns an INTERVAL object, not an integer. To get the difference in seconds or days, use
datediff()orunix_timestamp().
Related Documents
- TIMESTAMP_NTZ: timezone-free timestamp
- DATE: date-only type
- INTERVAL: time interval type
- Time Types
