Seriously? AMF doesn't send timezone? Wow...
We use SOAP, so all my problems simply come from the fact that Date doesn't include a timezone at all so everything is converted to local time when unmarshalling... On Tue, Dec 16, 2008 at 3:34 PM, Doug McCune <d...@dougmccune.com> wrote: > It's not that Flash Player decides it wants to convert the Date to a > different timezone. It's about what data Flash Player has about that Date. > When a Date is sent over the wire, particularly when using AMF either with > Blaze or CF or whatever, the date is sent as the Unix timestamp, which is > the number of milliseconds since 1970. That keeps the data transfer very > small and simple, all you need to send is a single Number, which only takes > up 8 bytes. > > So then Flash Player gets this single number, which represents the number > of milliseconds since 1970, and it has to figure out how to turn that into a > formatted Date. But that means that if you have a date of Jan 1 2008 @ 12pm > in California (Unix timestamp of 1199188800), that same timestamp gets shown > as 9am in New York. Because Flash Player has no idea that that same Unix > timestamp is meant to be formatted in California time, you end up showing > different times (and potentially even different dates if the timezone > difference extends across midnight). > > So like people have mentioned, in order to get the date to display the > right way you have to send more data. This can either mean sending the > timezone offset that is supposed to be used for display, which will then > require some offset conversion on the clientside, or sending the Date as a > String, which takes up more bytes than the simple Number and requires a > simple String to Date conversion on the client. > > But using the normal Date object with AMF will only send the number of > milliseconds since 1970, and that information alone is not enough if you > want to show the same formatted time across all timezones. > > Doug > > > On Mon, Dec 15, 2008 at 9:13 PM, Dale Fraser <d...@fraser.id.au> wrote: > >> The problem is that somehow. >> >> >> >> If the server serving that date is in a different location to you, flash >> player says, well I wont show that date I just got from the database, I'll >> adjust it to your time. This is totally useless, so for example if Im >> logging actions in an audit, the date in those logs could look different >> from one user to another. >> >> >> >> Regards >> >> Dale Fraser >> >> http://learncf.com >> >> http://flexcf.com >> >> >> >> >> >> *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On >> Behalf Of *Randy Martin >> *Sent:* Tuesday, 16 December 2008 3:52 PM >> >> *To:* flexcoders@yahoogroups.com >> *Subject:* RE: [flexcoders] Flex dates and time zones. >> >> >> >> I guess I really don't understand what the problem is here?? I have a >> smalldatetime (or a datetime) in a MSSQL database. I setup a value object in >> AS to have the date field as a Date object. I go get the date from >> ColdFusion using RemoteObject. The cfc sets up a CF "value object" with the >> date as a CF Date object. And, voila, the MSSQL datetime becomes an AS Date >> object. >> >> >> >> I don't have to convert anything to a string, or any other kind of object. >> So, what's the problem here??? >> >> >> >> ~randy >> >> >> >> *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On >> Behalf Of *Dale Fraser >> *Sent:* Monday, December 15, 2008 9:51 PM >> *To:* flexcoders@yahoogroups.com >> *Subject:* RE: [flexcoders] Flex dates and time zones. >> >> >> >> Why does Flex do this? >> >> >> >> If I get a date out of the db and want to deal with it as a date, surely >> this should be possible. How can the flash player determine it needs to >> change it to a different date. >> >> >> >> There must be some other option rather than converting to a string. >> >> >> >> Regards >> >> Dale Fraser >> >> http://learncf.com >> >> http://flexcf.com >> >> >> >> >> >> *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On >> Behalf Of *Paul Kukiel >> *Sent:* Tuesday, 16 December 2008 1:46 PM >> *To:* flexcoders@yahoogroups.com >> *Subject:* Re: [flexcoders] Flex dates and time zones. >> >> >> >> Thanks Tracy, >> >> >> >> I knew I was going to get this answer. I already got this working with >> strings as a test sample looks like I have to convert the rest of the app. >> Surely others are feeling my pain with this issue. >> >> >> >> And Nate I look forward to seeing what you have come up with when its >> ready. >> >> >> >> Paul. >> >> >> >> On 15/12/2008, at 7:46 PM, Tracy Spratt wrote: >> >> >> >> >> >> >> >> Pass the date as a string. >> >> Tracy >> >> >> ------------------------------ >> >> *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On >> Behalf Of *Paul Kukiel >> *Sent:* Monday, December 15, 2008 3:17 PM >> *To:* flexcoders@yahoogroups.com >> *Subject:* [flexcoders] Flex dates and time zones. >> >> >> >> I have a date in a server in Australia: 22/12/2008 12:00:00 AM >> >> I am using this label function for the grid to try and fix the time zone >> issue but my date always comes back to me as 21/12/2008 in the datagrid. I >> really just wan the exact date from the database regardless of where I am in >> the world. >> >> Any ideas? >> >> >> // Label Grid Date >> public static function labelGridDate(item:Object, >> column:DataGridColumn):String { >> var formatter:DateFormatter = new DateFormatter(); >> var myDate:Date = item[column.dataField]; >> formatter.formatString = "DD MMM YYYY"; >> >> var offsetMilliseconds:Number = >> item[column.dataField].getTimezoneOffset() * 60 * 1000; >> >> item[column.dataField].setTime(item[column.dataField].getTime() + >> offsetMilliseconds); >> >> return formatter.format(item[column.dataField]); >> } >> >> Paul. >> >> >> >> >> >> >> >> >> >> >> > > -- "Therefore, send not to know For whom the bell tolls. It tolls for thee." Like the cut of my jib? Check out my Flex blog! :: Josh 'G-Funk' McDonald :: 0437 221 380 :: j...@gfunk007.com :: http://flex.joshmcdonald.info/ :: http://twitter.com/sophistifunk