toTimestamp() converts a DATE or TIMEUUID value into a TIMESTAMP. The result is formatted as a readable timestamp, making date and time information easier to inspect. section 4.3.1
Extracting time from a TIMEUUID
Given a row containing a TIMEUUID, query it with SELECT text, toTimestamp(timeuuid) FROM basic WHERE text = 'uuids'; ScyllaDB returns a timestamp such as 2023-08-18 01:24:42.053000+0000 and labels the computed column system.totimestamp(timeuuid). section 4.4.1
Use the conversion functions according to the source and desired result:
- Use toDate() to convert a TIMESTAMP or TIMEUUID to a DATE. section 4.3.1
- Use toTimestamp() to convert a DATE or TIMEUUID to a TIMESTAMP. section 4.3.1
- Use toUnixTimestamp() to convert a DATE, TIMESTAMP, or UUID to epoch time as a BIGINT. section 4.3.1
cqlsh:types> SELECT text, toTimestamp(timeuuid) FROM basic where text = 'uuids';
Inspect the exact CQL expression used to extract a timestamp from a TIMEUUID. section 4.4.1
