Cassandra 解析日期
Cassandra parsing date
我使用以下脚本创建了一个 table:
CREATE TABLE "TestTable2" (
id uuid,
timestamp timestamp,
msg text,
priority int,
source text,
PRIMARY KEY (id, timestamp)
);
现在我要插入一行:
INSERT INTO "TestTable2" (id, timestamp, msg, source) values (uuid(), '2002-03-31 02:36:10', 'asdas dasdasd', 'system1');
我得到一个错误:
Unable to execute CQL script on 'UdcCluster':Unable to coerce '2002-03-31 02:36:10' to a formatted date (long)
如果我将月中的某天更改为 30 日或将小时更改为 22,则语句将成功执行。
你能给我解释一下日期有什么问题吗?
PS。
“1998-03-29 02:12:13”、“1987-03-29 02:55:21”和“1984-03-25 02:45:25”重复出现相同的错误。在所有情况下都是三月底的凌晨 2 点...
您正在尝试从特定本地时间获取 DateTime 实例,并且您希望它对夏令时具有鲁棒性。
在模式中指定时区:yyyy-mm-dd HH:mm:ssZ
where Z is the RFC-822 4-digit time zone, expressing the time zone's
difference from UTC. For example, for the date and time of Jan 2,
2003, at 04:05:00 AM, GMT:
If no time zone is specified, the time zone of the Cassandra
coordinator node handing the write request is used. For accuracy,
DataStax recommends specifying the time zone rather than relying on
the time zone configured on the Cassandra nodes.
https://docs.datastax.com/en/cql/3.1/cql/cql_reference/timestamp_type_r.html
我使用以下脚本创建了一个 table:
CREATE TABLE "TestTable2" (
id uuid,
timestamp timestamp,
msg text,
priority int,
source text,
PRIMARY KEY (id, timestamp)
);
现在我要插入一行:
INSERT INTO "TestTable2" (id, timestamp, msg, source) values (uuid(), '2002-03-31 02:36:10', 'asdas dasdasd', 'system1');
我得到一个错误:
Unable to execute CQL script on 'UdcCluster':Unable to coerce '2002-03-31 02:36:10' to a formatted date (long)
如果我将月中的某天更改为 30 日或将小时更改为 22,则语句将成功执行。 你能给我解释一下日期有什么问题吗?
PS。 “1998-03-29 02:12:13”、“1987-03-29 02:55:21”和“1984-03-25 02:45:25”重复出现相同的错误。在所有情况下都是三月底的凌晨 2 点...
您正在尝试从特定本地时间获取 DateTime 实例,并且您希望它对夏令时具有鲁棒性。
在模式中指定时区:yyyy-mm-dd HH:mm:ssZ
where Z is the RFC-822 4-digit time zone, expressing the time zone's difference from UTC. For example, for the date and time of Jan 2, 2003, at 04:05:00 AM, GMT:
If no time zone is specified, the time zone of the Cassandra coordinator node handing the write request is used. For accuracy, DataStax recommends specifying the time zone rather than relying on the time zone configured on the Cassandra nodes.
https://docs.datastax.com/en/cql/3.1/cql/cql_reference/timestamp_type_r.html