Is this a valid date format 2007 12 13+01:00?

We have a very strange situation. We expect some data from web service and then we process it in java code. Suddenly, it started to fail.

We found out, that we receive the date in such format: 2007-12-13+01:00 and it throws out an exception: java.lang.NumberFormatException: Invalid date/time. We use JAXB to Marshall the response and expect date to be java.util.Date. So far I didn't find any line of a code which handles the date, no trimming, converting or anything. Just marshaling.

Now there is a dispute whether this format is correct or incorrect and who caused this problem. Funny thing is, that there were no changes done in java code recently, the only difference is in the computer on which the build was made.

Might this be caused by different java version, ANT configuration? Do you have any suggestions what else can cause such problem? If you have any questions, please ask. I'll try to answer if it's possible.

LOG

Jon Skeet
people
quotationmark

I don't believe it's a valid ISO-8601 (or RFC 3339) format, which is what's usually used for web services - that only appears to include time zone offsets when a time is specified as well.

However, as noted in comments, it is a valid XML schema representation:

The lexical space of date consists of finite-length sequences of characters of the form: '-'? yyyy '-' mm '-' dd zzzzzz? where the date and optional timezone are represented exactly the same way as they are for dateTime. The first moment of the interval is that represented by: '-' yyyy '-' mm '-' dd 'T00:00:00' zzzzzz? and the least upper bound of the interval is the timeline point represented (noncanonically) by: '-' yyyy '-' mm '-' dd 'T24:00:00' zzzzzz?.

It sort of makes sense if you want to represent a whole day in a specific time zone - although as it only specifies the offset rather than a zone ID, it fails for 23 or 25 hour days with daylight saving transitions :(

I can't say I've personally ever seen it used in the wild though, nor modeled in date/time APIs.

people

See more on this question at Stackoverflow