插入到OrientDB中的DateTime转换错误 [英] DateTime conversion error on insert into OrientDB
问题描述
使用
格式转换日期2014-03-09T02:42:09.893时出错:yyyy-MM-dd'THH:mm:ss.SSS
这里的错误类型是 com.orientechnologies.orient.core.exception.OQueryParsingException
。
我使用以下方式设置DateTime格式:
ALTER DATABASE DATETIMEFORMAT yyyy-MM-dd'T'HH:mm:ss.SSS
此外,我知道这是一个与Orient vs Node API的错误,因为这也在控制台中失败:
INSERT INTO User(settings acceptedTerms,activitiesCount,
appFirstUseDate,birthday,email,equipment,feedOption,
followerCount,followingCount,followingFeedLastReadAt $ bgender,goal,height_unit,height_val1,height_val2,
kitchenSinkBadgesSeen,lastRatePrompt,lastVersionUsed,level,
numReferrals 平台,popularFeedLa stReadAt,postCount,
seenHamburgerInstructions,seenRatePrompt,stream,timezone,
unsubscribedFromWorkoutEmails,username,weight,weight_unit,
createdAt,updatedAt,objectId,ACL,sessionToken)VALUES
({__type:Pointer,className:Settings,objectId:K9X5P470hF },
true,10,{__type:Date,iso:2014-03-09T03:37:53.270Z},
{__type:Date ,iso:2000-03-29T00:00:00.000Z},
REMOVED@gmail.com,{1:[6,8,4]},1,0,0 ,
{__type:Date,iso:2014-03-12T00:32:11.245Z},2,2,1,5,3,
[activity ,schedule,findfriends,log,share,workouts / new,profile / l8QOwljKWh,editProfile,progress,workouts / today],
{ __type:Date,iso:2014-04-08T22:23:47.799Z},2.4.3,2,0,1,
{__type iso:2014-04-08T22:23:45.070Z},10,true,true,
b,America / Havana,true,hannah00329,128,1,
2014-03-09T02:42:09.893,2014-04-08T22:43:27.086,l8QOwl jKWh,
{*:{read:true},l8QOwljKWh:{read:true,write:true}},
t7h4bpx5ri8oyd3vfdt1l7e0b)
同样的错误:
错误:
com.orientechnologies.orient.core.exception.OQueryParsingException:
使用
格式转换日期2014-03-09T02:42:09.893时出错:yyyy-MM-dd'T 'HH:mm:ss.SSS
大多数其他DateTimes都可以工作,但由于某种原因,每10000个1中会出现此错误。 / p>
我表中的其他DateTimes看起来完全一样:
2013 -06-28T04:50:35.717
2013-07-03T08:16:10.713
2012-12-27T19:56:52.030
编辑:
进一步调查后,看起来像3月9日下午2点是末日...
SUCCESS:
2013-06-28T04:50:35.717Z
2013-07-03T08:16:10.713Z
2012-12-27T19:56:52.030Z
错误:
2014 -03-09T02:42:09.893Z
2014-03-09T02:11:49.764Z
2014-03-09T02:02:43.987Z
2014-03-09T02:10:39.408 Z
2014-03-09T02:37:10.196Z
2014-03-09T02:40:46.492Z
2014-03-09T02:22:26.589Z
编辑:
这里是我的OrientDB设置
-------------------------------- + ------------------------------------------------- --- +
NAME | VALUE |
-------------------------------- + ------------- --------------------------------------- +
名称| null |
版本| 9 |
日期格式| yyyy-MM-dd |
日期时间格式| yyyy-MM-dd HH:mm:ss |
时区|美国/多伦多|
区域设置国家|美国|
语言语言| en |
Charset | UTF-8 |
模式RID | #0:1 |
索引管理器RID | #0:2 |
字典RID | null |
-------------------------------- + ------------- --------------------------------------- +
2014-03-09T02:00:00 - > 2014-03-09T03:00:00
在纳入夏令时(DST)时不存在。
因为具体时间是不可能的使用DST,错误是将数据从数据库传输到没有的数据。 Parse允许的原因是因为它们使用协调世界时(UTC),而DST不会改变。
OrientDB中的修复如下:
- 将时区设置为utc
ALTER DATABASE TIMEZONE UTC
Error on conversion of date '2014-03-09T02:42:09.893' using the format: yyyy-MM-dd'T'HH:mm:ss.SSS
The type of error here is com.orientechnologies.orient.core.exception.OQueryParsingException
.
I set the DateTime format using:
ALTER DATABASE DATETIMEFORMAT yyyy-MM-dd'T'HH:mm:ss.SSS
Further, I know this is a bug with Orient vs the Node API I use because this also fails in the console:
INSERT INTO User ("settings", "acceptedTerms", "activitiesCount", "appFirstUseDate", "birthday", "email", "equipment", "feedOption", "followerCount", "followingCount", "followingFeedLastReadAt", "gender", "goal", "height_unit", "height_val1", "height_val2", "kitchenSinkBadgesSeen", "lastRatePrompt", "lastVersionUsed", "level", "numReferrals", "platform", "popularFeedLastReadAt", "postCount", "seenHamburgerInstructions", "seenRatePrompt", "stream", "timezone", "unsubscribedFromWorkoutEmails", "username", "weight", "weight_unit", "createdAt", "updatedAt", "objectId", "ACL", "sessionToken") VALUES ({"__type":"Pointer","className":"Settings","objectId":"K9X5P470hF"}, true, 10, {"__type":"Date","iso":"2014-03-09T03:37:53.270Z"}, {"__type":"Date","iso":"2000-03-29T00:00:00.000Z"}, "REMOVED@gmail.com", {"1":[6,8,4]}, 1, 0, 0, {"__type":"Date","iso":"2014-03-12T00:32:11.245Z"}, 2, 2, 1, 5, 3, ["activity","schedule","findfriends","log","share","workouts/new","profile/l8QOwljKWh","editProfile","progress","workouts/today"], {"__type":"Date","iso":"2014-04-08T22:23:47.799Z"}, "2.4.3", 2, 0, 1, {"__type":"Date","iso":"2014-04-08T22:23:45.070Z"}, 10, true, true, "b", "America/Havana", true, "hannah00329", 128, 1, "2014-03-09T02:42:09.893", "2014-04-08T22:43:27.086", "l8QOwljKWh", {"*":{"read":true},"l8QOwljKWh":{"read":true,"write":true}}, "t7h4bpx5ri8oyd3vfdt1l7e0b")
With the same error:
Error: com.orientechnologies.orient.core.exception.OQueryParsingException: Error on conversion of date '2014-03-09T02:42:09.893' using the format: yyyy-MM-dd'T'HH:mm:ss.SSS
Most other DateTimes work, but for some reason 1 in every 10000 fails with this error.
The other DateTimes in my table look exactly the same:
2013-06-28T04:50:35.717
2013-07-03T08:16:10.713
2012-12-27T19:56:52.030
EDIT:
Upon further investigation, it looks like 2pm on March 9th is doomsday...
SUCCESS:
2013-06-28T04:50:35.717Z
2013-07-03T08:16:10.713Z
2012-12-27T19:56:52.030Z
ERROR:
2014-03-09T02:42:09.893Z
2014-03-09T02:11:49.764Z
2014-03-09T02:02:43.987Z
2014-03-09T02:10:39.408Z
2014-03-09T02:37:10.196Z
2014-03-09T02:40:46.492Z
2014-03-09T02:22:26.589Z
EDIT:
Here are my OrientDB settings
--------------------------------+----------------------------------------------------+
NAME | VALUE |
--------------------------------+----------------------------------------------------+
Name | null |
Version | 9 |
Date format | yyyy-MM-dd |
Datetime format | yyyy-MM-dd HH:mm:ss |
Timezone | America/Toronto |
Locale Country | US |
Locale Language | en |
Charset | UTF-8 |
Schema RID | #0:1 |
Index Manager RID | #0:2 |
Dictionary RID | null |
--------------------------------+----------------------------------------------------+
2014-03-09T02:00:00 -> 2014-03-09T03:00:00
does not exist when incorporating Daylight Savings Time (DST).
Because that specific time is impossible when using DST, the error was in transferring the data from a database that allowed it to one that didn't. The reason Parse allows it is because they use Coordinated Universal Time (UTC), which does not change with DST.
The fix in OrientDB is as follows:
-- set timezone to utc
ALTER DATABASE TIMEZONE UTC
这篇关于插入到OrientDB中的DateTime转换错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!