插入到OrientDB中时的DateTime转换错误

时间:2014-07-03 19:45:03

标签: sql debugging datetime insert orientdb

  

转换日期错误' 2014-03-09T02:42:09.893'使用   格式:yyyy-MM-dd' H&H; 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","生日","电子邮件","设备"," feedOption",   " followerCount"," followCount"," followFeedLastReadAt",   "性别","目标"," 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   ({" __类型":"指针""的className":"设置""的ObjectID":&#34 ; K9X5P470hF"},   true,10,{" __ type":" Date"," iso":" 2014-03-09T03:37:53.270Z"} ,   {" __类型":"日期"" 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,   ["活动""时间表"" findfriends""登录""份额""锻炼/新""简档/ l8QOwljKWh"" editProfile""进度""锻炼/今天&#34],   {" __ type":" Date"," iso":" 2014-04-08T22:23:47.799Z"},&#34 ; 2.4.3",2,0,1,   {" __ type":" Date"," iso":" 2014-04-08T22:23:45.070Z"},10,true ,是的,   " b"," America / Havana",true," hannah00329",128,1,   " 2014-03-09T02:42:09.893"," 2014-04-08T22:43:27.086"," l8QOwljKWh",   {" *" {"读":真}" l8QOwljKWh" {"读":真,"写& #34;:真}},   " t7h4bpx5ri8oyd3vfdt1l7e0b&#34)

出现同样的错误:

  

错误:   com.orientechnologies.orient.core.exception.OQueryParsingException:   转换日期错误' 2014-03-09T02:42:09.893'使用   格式:yyyy-MM-dd' H&H; mm:ss.SSS

大多数其他DateTime都有效,但由于某种原因,每10000个中有1个因此错误而失败。

我表格中的其他日期时间看起来完全一样:

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

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

编辑:

这是我的OrientDB设置

--------------------------------+----------------------------------------------------+
 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                                               |
--------------------------------+----------------------------------------------------+

1 个答案:

答案 0 :(得分:2)

合并夏令时(DST)时

2014-03-09T02:00:00 -> 2014-03-09T03:00:00不存在。

因为在使用DST时不可能有特定的时间,所以错误在于将数据从数据库传输到允许它的数据库。 Parse允许它的原因是因为它们使用协调世界时(UTC),它不随DST而变化。

OrientDB中的修复程序如下:

-- set timezone to utc
ALTER DATABASE TIMEZONE UTC