Cassandra 时间未保存为 UTC
Cassandra time not saved in UTC
我需要将我的时间戳分别拆分为日期和时间,然后使用 'date' 和 'time' cqltypes 插入到数据库列中。
我试图将时间值作为字符串插入到 Cassandra table。时间已转换为 UTC (05:27:00)。但是,当我使用 Datastax devcenter 检查 table 时,列中填充了值“09:37:54.935541808”。我尝试使用存储库检索 spring 中的值,然后它返回值为“3473746674935541808”。
如何从 table 获取正确的时间值?
好像是Spring-data的限制。在 Cassandra 中,time
值被编码为一个 64 位有符号整数,代表自午夜以来的纳秒数。但是我没有看到 time
类型在 spring-data-cassandra documentation, so you may need to write your custom converter for it, as described in documentation.
中被列为受支持
我需要将我的时间戳分别拆分为日期和时间,然后使用 'date' 和 'time' cqltypes 插入到数据库列中。
我试图将时间值作为字符串插入到 Cassandra table。时间已转换为 UTC (05:27:00)。但是,当我使用 Datastax devcenter 检查 table 时,列中填充了值“09:37:54.935541808”。我尝试使用存储库检索 spring 中的值,然后它返回值为“3473746674935541808”。
如何从 table 获取正确的时间值?
好像是Spring-data的限制。在 Cassandra 中,time
值被编码为一个 64 位有符号整数,代表自午夜以来的纳秒数。但是我没有看到 time
类型在 spring-data-cassandra documentation, so you may need to write your custom converter for it, as described in documentation.