Converting ISO 8601 dateTime to TimeStampOffset
Posted: Thu Jul 19, 2012 2:52 am
by Jason
I need to read an XML message from an MSMQ. This message contains dateTimes in the ISO 8601 format (see
http://www.w3.org/TR/xmlschema-2/#dateTime for more information). For example: 12/01/2012 14:00 would be represented in the XML message as "2012-01-12T14:00:00.00+00:00". I then need to store this as a TimeStampOffset.
Does anyone have any experience of converting ISO 8601 dateTimes to Jade TimeStampOffset types?
Re: Converting ISO 8601 dateTime to TimeStampOffset
Posted: Thu Jul 19, 2012 2:13 pm
by murray
It's just string handling, isn't it? Or is there some tricky stuff involving the time zones?
I have code that parses the ISO format (without TZ offset) into a Jade TimeStamp. Would that be of any help to get you started?
Re: Converting ISO 8601 dateTime to TimeStampOffset
Posted: Fri Jul 20, 2012 9:03 am
by Jason
Thanks Murray, parsing is certainly an option. Before going down that track though, I thought I'd check to see if this problem had already been solved.
I suspect the timezone part will be a bit fiddly as TimeStampOffset is the UTC time plus the offset, whereas the ISO 8601 format is the local time plus the timezone. Extracting the date and time should be straightforward (split on the 'T' and cast to the appropriate type).