I am using Flash with the WebService class (via actionscript) to interact with
an ASP.NET 2.0 XML Web Service. When retrieving information that is in
DateTime format (in returned object) I am having a problem when the time has
less than 3 digits for milliseconds. For example:
This is parsed ok:
2005-07-27T10:13:10.827-04:00
And even this is ok:
2005-07-27T10:50:27.8125-04:00
But, if the milliseconds are less than 3 digits like:
2005-07-26T16:45:41.5-04:00
Or:
2005-07-27T08:02:38.53-04:00
Flash isn't able to parse it. I can think of a few workarounds, but I am
curious if anyone else has experienced this or can offer a fix.
Thanks in advance!
orangechicken - 23 Mar 2006 21:49 GMT
Hey CI2 - You're one of the few people to mention this bug which I find weird.
The simplest way to recreate this bug is to access a web service that returns
at dateTime in the format "2000-01-12T12:13:14Z". Crazy that this bug exists,
because the W3C's **example** is in that format (see
http://www.w3.org/TR/xmlschema-2/#isoformats). Notice there's no millisecond.
The bug itself exists in mx.services.PendingCall.decodeDate() where it
*assumes* there's milliseconds. The only way to work around it is to have your
web service put out a *string* that's in a format Flash can handle (or use the
datatype of 'date' instead of 'dateTime' if the time isn't important for your
usage).
That workaround is a hassle because then you have to write parsing code - bleh.
CI2 - 24 Mar 2006 12:46 GMT
I ended up handling it on the web service side because of the extensive yet
easy to use date/time manipulation capabilities in .NET. The milliseconds were
not important, so I simply changed the msec value to 555 before sending it out.
Seems to work just fine, and it only added a single line to my c# code.
Thanks for the response!