开发者

Do time zone specification in XMLMapper works?

I receive DateTime in XML file like this 2009-12-14 05:07:38Z.

So, I thought it was a mistake but after little googling, I find this :

http://www.w3schools.com/Schema/schema_dtypes_date.asp

Time Zones To specify a time zone, you can either enter a time in UTC time by adding a "Z" behind the time - like this:

09:30:10Z

but when I speficy DateTime in a node in my XMLMapper : my dat开发者_运维知识库etime is trunc and I just get the date.

Do I need more coffee ?

What is the way to manage this ?

Thanks


Hugues,

The 'Z' (Zulu) time zone representation comes from ISO 8601, and it can apply to either a time value, or a date-time value. The string in your example comprises one string representing a date '2009-12-14', a space separator, and a second string representing a time with a time zone indicator '05:07:38Z'. If you want a Combined Date and time representation, the intervening space should be replaced with a 'T', i.e. '2009-12-14T05:07:38Z'

I'm not familiar with XMLMapper, but it looks like it is interpreting the string correctly according to ISO 8601, processing only the part up to the space. You may be able to process the time part of the string separately & combine them, or replace the ' ' with a 'T' before processing, or possibly even subclass something to accept this (all too common) bastardized representation...

Max

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜