Converting TimeUUID Strings to Dates – DataStax Support
TimeUUID is one of the datatypes supported by Cassandra. The Cassandra JDBC driver will return a hexadecimal representation of the UUID rather than a human-readable date. You can use the java.util.UUID and java.util.Date classes to convert from a TimeUUID string to a Date. The UUID.timestamp() returns a long containing the timestamp value associated with this UUID. The resulting timestamp is measured in 100-nanosecond units since midnight, October 15, 1582 UTC. Notice that this is a different epoch and resolution than the long expected by Date's constructor, which is the number of milliseconds since January 1, 1970, 00:00:00 GMT. Therefore, the conversion requires some math. Here is some example code to convert from a string representing a TimeUUID string to a java.util.Date object:Read full article from Converting TimeUUID Strings to Dates – DataStax Support
No comments:
Post a Comment