Well, the thing is that any Date that gets send to a WebService by Flex will be passed in a string format that does include timezone information (in Flash/Flex, you cannot have Date objects without any time information - even if you set hours, minutes, seconds to 0 the Date still carries time information)
If I would send a Date object from Flex just in this moment it would be passed as a string that looks approx. like this: 2006-06-16T18:49:00Z So, on my local machine it's 20:49h (or 8:49pm) as I'm located in Germany (that's UTC+1 plus 1 hour for daylight saving, so effectively it's UTC+2 - that's why it's sending 18:49 - it's my local time in UTC time) Basically, all you have to do in .NET is to handle the dateTime as UTC and make sure to always return UTC dates back to Flash/Flex. Dirk. > -----Original Message----- > From: [email protected] > [mailto:[EMAIL PROTECTED] On Behalf Of kellyb723 > Sent: Friday, June 16, 2006 8:39 PM > To: [email protected] > Subject: [flexcoders] Re: Dates WebServices .NET (redux) > > The problem is more than just .NET not including the time > zone. My App does not care about the time zone at all. I do > not have time zone information internally. I just does not > matter, especially when storing fields like Birthdate. The > pain point is that a date of 1/1/2000 gets shifted to > 12/31/1999 5:00PM when flex receives it. > > This is also weird because I'm in PDT time right now but it's > incorrectly shifting by 8 hours instead of 7 (timezoneOffset = 480). > When I create a new Date in Actionscript I get a > timezoneOffset of 420 (correct). > > Whenever I send a date to a web service it get shifter back > by the timeZone offset. So even if I compensate for this by > manually writing a bunch of code to loop through arrays > returned from web services and fix every date field, they get > messed up again when I send it back to save the record. > > In you message you say: > "We have a bug that asks us to consider a change to this > behavior to assume the local client timezone when creating > the date, but both of these solutions are technically arbitrary." > > Would it be possible in Flex 2.0 to give the option to the user. > Could there just be a property of the WebService or Operation > object like defaultTimezone with options of "utc" & "local". > This would be keep flex from having to make a completely > arbitrary decision about my web services and make > implementation much easier for developers using .NET middle tiers. > > I've looked in the Flex SDK source and could not find the > source for the WebService component or I would have created a > replacement component myself. As for the moment I'm going to > have to add code to my .NET app to force it to send <... > type="s:string" /> in the WSDL and then just use strings in > Flex, but this is not really a good solution. > > - Kelly > > --- In [email protected], "Peter Farland" > <[EMAIL PROTECTED]> wrote: > > > > The problem is that .NET returns the dateTime without timezone > > information, i.e. the value "1977-06-12T00:00:00" is missing the > > suffix for timezone data. If it returned "1977-06-12T00:00:00Z" or > > some other timezone info it would work fine. In XSD the > absence of a > > timezone means the date/time is technically indeterminate by a > > significant range (+/- > > 14 hours for various DST worst cases I presume). Flex 2.0 > interprets > > an XSD dateTime as an ActionScript Date in all cases - but > without any > > timezone information it currently uses UTC to construct the > date. We > > have a bug that asks us to consider a change to this behavior to > > assume the local client timezone when creating the date, > but both of > > these solutions are technically arbitrary. > > > > Irrespective of Flex, ActionScript Dates are always > displayed in the > > local timezone no matter what... there are various UTC > helper methods > > to get information back in the UTC timezone. > > > > Your manual correction probably isn't working because you > would have > > to take into account that the timezone-less dateTime has been > > interpreted in the UTC timezone but then on the default > display of the > > Date it's in your local timezone. If you can't get .NET to include > > timezone information then for now I suggest sending a String back > > instead to avoid this complication. > > > > > > ________________________________ > > > > From: [email protected] > [mailto:[EMAIL PROTECTED] > > On Behalf Of kellyb723 > > Sent: Friday, June 16, 2006 12:32 AM > > To: [email protected] > > Subject: [flexcoders] Dates WebServices .NET (redux) > > > > > > > > I read an old thread on this but there did not seem to be any > > resolution. > > > > Has someone found a way to turn off the automatic inaccurate > > conversion to local time that Flex 2.0 does to dates it > receives from > > .NET Web Services? > > > > The date line in my WSDL is as follows: > > <s:element minOccurs="1" maxOccurs="1" name="BirthDate" > > nillable="true" type="s:dateTime"/> > > > > If the web service sends "1977-06-12T00:00:00" in the response Flex > > receives it and creates a Date property to the object but > converts it > > for the machines local timezone. Worse yet, even if i manually > > compensate for this in AS3 code it get coverted the other way when > > going back in the to the server for the Save service. > > > > This problem has me pulling my hair out. My app does all timezone > > management interally, adn mostly just doesn't care. I just > want this > > turned off. > > > > Can anyone Help? > > > > - Kelly > > > > > > > > > ------------------------ Yahoo! Groups Sponsor > --------------------~--> Something is new at Yahoo! Groups. > Check out the enhanced email design. > http://us.click.yahoo.com/SISQkA/gOaOAA/yQLSAA/nhFolB/TM > -------------------------------------------------------------- > ------~-> > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: > http://www.mail-archive.com/flexcoders%40yahoogroups.com > Yahoo! Groups Links > > > > > > > ------------------------ Yahoo! Groups Sponsor --------------------~--> Yahoo! Groups gets a make over. See the new email design. http://us.click.yahoo.com/XISQkA/lOaOAA/yQLSAA/nhFolB/TM --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

