Re: [flexcoders] Flex dates and time zones.

2008-12-16 Thread Paul Hastings
Ricky Bacon wrote:
> It's actually a Unix thing: http://en.wikipedia.org/wiki/Unix_time

no dale's right, java is *milliseconds* since epoch start, unix is *seconds*.


Re: [flexcoders] Flex dates and time zones.

2008-12-16 Thread Ricky Bacon
Dale Fraser wrote:
> That whole milliseconds past 1970 is a Java thing and has bitten me 
> before, one of many reasons we ditched Java.

It's actually a Unix thing: http://en.wikipedia.org/wiki/Unix_time

The standard has been around for almost 40 years.

-Ricky


RE: [flexcoders] Flex dates and time zones.

2008-12-15 Thread Dale Fraser
Its because the timezone is not stored in the date, so what would it send.
It should just send the date or at least have an option to do so.

 

Regards

Dale Fraser

 <http://learncf.com/> http://learncf.com

 <http://flexcf.com/> http://flexcf.com

 

 

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Josh McDonald
Sent: Tuesday, 16 December 2008 4:38 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Flex dates and time zones.

 

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  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  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://learncf.com/> 

http://flexcf.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://learncf.com/> 

http://flexcf.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@yah

RE: [flexcoders] Flex dates and time zones.

2008-12-15 Thread Dale Fraser
Well, then that is a major AMF flaw.

 

I store my dates in a database as dates, not as milliseconds past 1970 and
with no timezone. AMF should transfer them as dates and display them as
transferred, not that hard.

 

That whole milliseconds past 1970 is a Java thing and has bitten me before,
one of many reasons we ditched Java.

 

Regards

Dale Fraser

 <http://learncf.com/> http://learncf.com

 <http://flexcf.com/> http://flexcf.com

 

 

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Doug McCune
Sent: Tuesday, 16 December 2008 4:34 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Flex dates and time zones.

 

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  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://learncf.com/> 

http://flexcf.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://learncf.com/> 

http://flexcf.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, Decembe

Re: [flexcoders] Flex dates and time zones.

2008-12-15 Thread Josh McDonald
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  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  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 an

Re: [flexcoders] Flex dates and time zones.

2008-12-15 Thread Doug McCune
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  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/

RE: [flexcoders] Flex dates and time zones.

2008-12-15 Thread Dale Fraser
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://learncf.com

 <http://flexcf.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://learncf.com/> 

http://flexcf.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 ";

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.






 

 

 

 



Re: [flexcoders] Flex dates and time zones.

2008-12-15 Thread Nate Beck
Here's what it comes down to...
The Date class in flash doesn't natively allow you to have a timezone other
than your local timezone and UTC.

Take this example (my computer is in PST time):

var myDate:Date = new Date("Mon Dec 15 12:00:00 GMT-0400 2008");

trace(myDate.toString());
trace(myDate.toUTCString());

Output:
Mon Dec 15 08:00:00 GMT-0800 2008
Mon Dec 15 16:00:00 2008 UTC

So if someone passes a DateTime from a server that has a timezone offset
which differs from the local timezone of the client's machine.  Flex doesn't
save that offset when it's unmarshalled.  If you pass them as a string, the
timezone data is preserved.

HTH,
Nate

On Mon, Dec 15, 2008 at 8:51 PM, Randy Martin  wrote:

>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 ";
>
> 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.
>
>
>
>
>
>
>
>
>
>   
>


Re: [flexcoders] Flex dates and time zones.

2008-12-15 Thread Josh McDonald
If you're in the US, you're unlikely to run up against these issues at all.
The problem is, computers think about dates and times attached to timezones,
but most of the time our clients do not. That and Flash has no "date-only"
object, whereas people want to use dates instead of datetimes all over the
place.

On Tue, Dec 16, 2008 at 2:51 PM, Randy Martin  wrote:

>  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 ";
>
> 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


RE: [flexcoders] Flex dates and time zones.

2008-12-15 Thread Randy Martin
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://learncf.com/> 

http://flexcf.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 ";

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.





 

 

 

 



Re: [flexcoders] Flex dates and time zones.

2008-12-15 Thread Josh McDonald
I've had a fair bit of experience wrestling date problems in Flex; Aside
from the fact that SchemaManager marshalls xsi:Date as Zulu time instead of
local (which isn't technically incorrect, just annoying as hell for us
aussies), every time there's a problem it's because Flex is doing the right
thing, and the server is sending an incorrect value, or what the clients
actually want is not possible without also passing along the server timezone
in another field.

For you aussies out there, the easiest way to cut down on these problems is
to use midday instead of midnight when you're referring to an "all day" date
using a Flash Date or xsi:DateTime. We do this by filtering requests and
responses on the server-side, and a subclass of DateField that sets the time
values to midday (as well as letting you 'unset' the date value) on the
client side.

If you're getting yesterday in Flex when you mean today, you've usually got
00:00:00+10:00 on the server, and it's getting truncated after being
converted to Zulu for transport somewhere. Or, you're setting a midnight
date in NSW which is +11 at the moment, and the client machine is in
Queensland which is still +10, or somewhere else which is further West. Your
server sends "(today)T00:00:00+11:00", which may or may not get converted to
Zulu as "(yesterday)13:00:00Z" in transport. The client correctly interprets
this as "23:00:00+10:00" on the client machine, which is then truncated when
displaying as  date-only display field.

Basically, if you want clients in timezone X to show times that are in
timezone Y, you need to have timezone Y be part of the information you're
sending alongside the actual datetime value, or send strings.

-Josh

On Tue, Dec 16, 2008 at 1:51 PM, Dale Fraser  wrote:

>  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 ";
>
> 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


RE: [flexcoders] Flex dates and time zones.

2008-12-15 Thread Dale Fraser
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://learncf.com

 <http://flexcf.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 ";

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.




 

 

 

 



Re: [flexcoders] Flex dates and time zones.

2008-12-15 Thread Paul Kukiel

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 ";

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.









Re: [flexcoders] Flex dates and time zones.

2008-12-15 Thread Nate Beck
I'm working on timezone support within flash that I'm going to release as
open source very soon.  I'll update this thread when I do.
But Tracy is right, you can always just pass a string from the server.

On Mon, Dec 15, 2008 at 4: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 ";
>
> 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.
>
>
>


RE: [flexcoders] Flex dates and time zones.

2008-12-15 Thread Tracy Spratt
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 ";

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.



 



[flexcoders] Flex dates and time zones.

2008-12-15 Thread Paul Kukiel
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 ";

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.