I am working on some code which receives an RFC 3339 formatted time string from a Linux web server. I found that the Android Time.parse3339() routine always throws an exception:
"Unexpected 0 at position 19. Expected + or -" when it parses the RFC 3339 time string that came from the Linux web server. An example of a time string that it is parsing when throwing the exception is: 2010-07-18T20:10:00+00:00 I found a reference to RFC 3339 at http://www.rfc-archive.org/getrfc.php?rfc=3339 and read through the RFC to try and understand why the Android is throwing an exception. The RFC shows the following valid time strings in the examples section of the RFC: 1985-04-12T23:20:50.52Z 1996-12-19T16:39:57-08:00 1990-12-31T23:59:60Z 1990-12-31T15:59:60-08:00 1937-01-01T12:00:27.87+00:20 These examples show the allowed variations of including or not including the fractional seconds, and using a time zone offset or letter. The time string I am parsing appears to be fully compliant with RFC 3339. I read through the Android documentation for the Time.parse3339() routine at http://osdir.com/ml/Android-Developers/2010-07/msg00876.html and was surprised to see that it has example time strings that are NOT compliant with RFC 3339. The sample time strings shown in the Android documentation are: 2008-10-13T16:00:00.000Z 2008-10-13T16:00:00.000+07:00 2008-10-13T16:00:00.000-07:00 2008-10-13 I was very surprised to find that these time strings are NOT compliant with RFC 3339, and even more surprised to find that the Android 3339 parsing logic seems unable to process strings that are in the proper RFC 3339 time format. I found some other posts on the web with people seeing similar issues with the Time.parse3339() routine such as http://osdir.com/ml/Android-Developers/2010-07/msg00876.html and http://osdir.com/ml/org.google.api.data/2007-02/msg00030.html Does anyone know what is going on with the Time.parse3339() code? What is the purpose of internet standards such as RFCs if platforms like the Android decide to do time strings in a different format than that specified in the RFC, and then falsely claims to be using RFC 3339 time strings? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en