You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Jack Yu <jy...@appcomputing.com> on 2013/09/24 09:42:11 UTC

blazeDS time zone

Hi,

 

BlazeDS automatically translate the time stamp between the client time zone
setting the server time zone.

 

is there an easy way to disable this time zone translation in BlazeDS?

 

so that if the date is stored in server (which has GMT time) as 1/1/2013
00:00:00, if the client is in PT -8, the client still get date as 1/1/2013
00:00:00

 

currently, the blazeDS automatically translate the time to 12/31/2012
16:00:00 because the client time zone is -8

 

Thanks

Jack


RE: blazeDS time zone

Posted by Alex Harui <ah...@adobe.com>.
Justin is recommending not to use Date.  It represents a fixed point in time.  You don't want it to work that way, so saving it as a string or a record is probably better.  It was 10.5 in Virginia when the user in India hit save.  When viewed in India it should still say 10.6 because the timezone will be fixed up correctly.  And when viewed in the US it happened on 10.5 before or after other transactions that happened on 10.5 in the US.  If you want to view the date from Virginia as the user in India would see it, you have to change your computer to that timezone, or do the math before viewing the date.
________________________________________
From: Oleg Konovalov [olegkon@gmail.com]
Sent: Tuesday, October 01, 2013 7:48 AM
To: dev@flex.apache.org
Subject: Re: blazeDS time zone

Justin,

My client is a large global company which is in ever region. So when user
in India saves data on server in Virginia, it shows him as saved 10.5 he's
later than he specified. How to fix it?
Also is conversion to ITCh done as date.getUTCDate() ?
On Sep 24, 2013 4:03 AM, "Justin Mclean" <ju...@classsoftware.com> wrote:

> Hi,
>
> > BlazeDS automatically translate the time stamp between the client time
> zone
> > setting the server time zone.
>
> As I mentioned in anther thread, this is a Flash Player feature not a
> BlaseDS one. Have a read of
>
> http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Date.html
>
> As a result there's no option in BlazeDS to turn this off.
>
> Note this rather nasty issue:
> "However, the transition dates currently in effect are applied to dates in
> the past and the future, so the daylight saving time bias might calculate
> incorrectly for dates in the past when the locale had different transition
> dates."
>
> You best option is not to send Date objects about but use some other
> representation of dates. eg a String in the form "YYYY-MM-DD" or UTC time
> (a long)
>
> This has been discussed on the user and dev lists a few times, here's one
> example:
> http://apache-flex-users.2333346.n4.nabble.com/New-Date-issues-tc2679.html
>
> If you search you'll find a few other conversations.
>
> Thanks,
> Justin

Re: blazeDS time zone

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

> My client is a large global company which is in ever region. So when user
> in India saves data on server in Virginia, it shows him as saved 10.5 he's
> later than he specified. How to fix it?

On projects I've worked on we've set the server time to GMT/UTC this make calculations like that much easier. Saving all date/time as UTC in the server and displaying in local time then requires no time zone conversion calculations.

> Also is conversion to UTC done as date.getUTCDate() ?
No that only returns the UTC day of the month, date.UTC() is the method you want, date.toLocalString() and date.toUTCString() are also useful methods.

Thanks,
Justin

Re: blazeDS time zone

Posted by Oleg Konovalov <ol...@gmail.com>.
Justin,

My client is a large global company which is in ever region. So when user
in India saves data on server in Virginia, it shows him as saved 10.5 he's
later than he specified. How to fix it?
Also is conversion to ITCh done as date.getUTCDate() ?
On Sep 24, 2013 4:03 AM, "Justin Mclean" <ju...@classsoftware.com> wrote:

> Hi,
>
> > BlazeDS automatically translate the time stamp between the client time
> zone
> > setting the server time zone.
>
> As I mentioned in anther thread, this is a Flash Player feature not a
> BlaseDS one. Have a read of
>
> http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Date.html
>
> As a result there's no option in BlazeDS to turn this off.
>
> Note this rather nasty issue:
> "However, the transition dates currently in effect are applied to dates in
> the past and the future, so the daylight saving time bias might calculate
> incorrectly for dates in the past when the locale had different transition
> dates."
>
> You best option is not to send Date objects about but use some other
> representation of dates. eg a String in the form "YYYY-MM-DD" or UTC time
> (a long)
>
> This has been discussed on the user and dev lists a few times, here's one
> example:
> http://apache-flex-users.2333346.n4.nabble.com/New-Date-issues-tc2679.html
>
> If you search you'll find a few other conversations.
>
> Thanks,
> Justin

Re: blazeDS time zone

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

> BlazeDS automatically translate the time stamp between the client time zone
> setting the server time zone.

As I mentioned in anther thread, this is a Flash Player feature not a BlaseDS one. Have a read of 
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Date.html

As a result there's no option in BlazeDS to turn this off.

Note this rather nasty issue:
"However, the transition dates currently in effect are applied to dates in the past and the future, so the daylight saving time bias might calculate incorrectly for dates in the past when the locale had different transition dates."

You best option is not to send Date objects about but use some other representation of dates. eg a String in the form "YYYY-MM-DD" or UTC time (a long)

This has been discussed on the user and dev lists a few times, here's one example:
http://apache-flex-users.2333346.n4.nabble.com/New-Date-issues-tc2679.html

If you search you'll find a few other conversations.

Thanks,
Justin

Re: blazeDS time zone

Posted by Justin Mclean <ju...@classsoftware.com>.
HI,

> I remember that using custom property proxies in BlazeDS I was able to adjust the serialization exactly the way I wanted to.
Probably via implementing IExternalizable and adding a writeExternal and readExternal to all classes you want to serialise in a different way. Might be a possible way to get around the date issue, but would be a reasonable amount of work, and once you de-serliased/converted back to date the FP would still adjust to the local timezone.

Thanks,
Justin

AW: AW: blazeDS time zone

Posted by Christofer Dutz <ch...@c-ware.de>.
Hi Modi,

I think the problem is that per default Date values are transferred in UTC (see [1])
In the documentation they say "Clients and servers must adjust time accordingly for time zones." So unfortunately you will probably have to do something here.
But it's not that difficult to implement a so-called property-proxy in which you provide a custom (de)serialization on client and server. I wrote an article on this. Unfortunately this is about serializing Enum types, but I think it should get you started [2]

Hope that helps,
    Chris

[1] http://help.adobe.com/en_US/LiveCycleDataServicesES/3.1/Developing/WSc3ff6d0ea77859461172e0811f00f6eab8-7ffdUpdate.html
[2] https://dev.c-ware.de/confluence/display/PUBLIC/Flexmojos+generated+AS3+model+with+Enum+support+using+BlazeDS
________________________________________
Von: manojModi <ma...@gmail.com>
Gesendet: Montag, 9. Mai 2016 19:01:23
An: dev@flex.apache.org
Betreff: Re: AW: blazeDS time zone

Hi Chris,


BlazeDS automatically translate the time stamp between the client time zone
setting the server time zone.



is there an easy way to disable this time zone translation in BlazeDS?



so that if the date is stored in server (which has GMT time) as 1/1/2013
00:00:00, if the client is in PT -8, the client still get date as 1/1/2013
00:00:00



currently, the blazeDS automatically translate the time to 12/31/2012
16:00:00 because the client time zone is -8

 please give me the sample app

Thanks
Modi




--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/blazeDS-time-zone-tp29922p52928.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: AW: blazeDS time zone

Posted by manojModi <ma...@gmail.com>.
Hi Chris,


BlazeDS automatically translate the time stamp between the client time zone 
setting the server time zone. 

  

is there an easy way to disable this time zone translation in BlazeDS? 

  

so that if the date is stored in server (which has GMT time) as 1/1/2013 
00:00:00, if the client is in PT -8, the client still get date as 1/1/2013 
00:00:00 

  

currently, the blazeDS automatically translate the time to 12/31/2012 
16:00:00 because the client time zone is -8 

 please give me the sample app

Thanks 
Modi




--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/blazeDS-time-zone-tp29922p52928.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

AW: blazeDS time zone

Posted by "christofer.dutz@c-ware.de" <ch...@c-ware.de>.
Hi,

I remember that using custom property proxies in BlazeDS I was able to adjust the serialization exactly the way I wanted to. Unfortunately this was in an older Project ... Hopefully I can have a look for it this Weekend and I'll post it here.

Chris

________________________________________
Von: Jack Yu [jyu@appcomputing.com]
Gesendet: Dienstag, 24. September 2013 09:42
An: dev@flex.apache.org
Betreff: blazeDS time zone

Hi,



BlazeDS automatically translate the time stamp between the client time zone
setting the server time zone.



is there an easy way to disable this time zone translation in BlazeDS?



so that if the date is stored in server (which has GMT time) as 1/1/2013
00:00:00, if the client is in PT -8, the client still get date as 1/1/2013
00:00:00



currently, the blazeDS automatically translate the time to 12/31/2012
16:00:00 because the client time zone is -8



Thanks

Jack