TIMESTAMP
The TIMESTAMP
type is used to represent dates and timestamps, and can include timezone information. By default, timestamps are represented as local time (TIMESTAMP_LTZ
). All operations are performed in the current session's timezone, and the output results are based on the timezone of the current Lakehouse service. Users can input timestamps in various formats, which are automatically converted to the TIMESTAMP
type. The output result is in string format, with the format 'yyyy-MM-dd HH:mm:ss'
. If the user input includes milliseconds, the output result will also include milliseconds. The maximum precision supported is up to microseconds (us), and the precision depends on the precision of the timestamp at the time of writing.
Syntax
Example
- Using the default timestamp format:
- Using Different Formats of Timestamps: {#using-different-formats-of-timestamps}
- Convert string to timestamp type:
- Using Different Precision Options:
Notes
- When performing timestamp conversion, please be aware that time zone differences may cause discrepancies.
- Ensure that the input timestamp format matches the format supported by the system to avoid errors.