[flexcoders] Re: DateFormatter and Date Timezone Issue

2008-02-26 Thread Doug Lowder
Hi Phil,

You just have the wrong format string for your DateFormatter.  HH 
shows the hour as 1 through 24, which is one too many for 24-hour 
format (0-23).  You want the following:

mx:DateFormatter id=df formatString=MM/DD/YY JJ:NN /

JJ specifies the hour in 24-hour format.


--- In flexcoders@yahoogroups.com, Phil Heinz [EMAIL PROTECTED] wrote:

 To illustrate this issue, I have the following application:
 
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
 layout=absolute creationComplete=init()
   mx:Script
   ![CDATA[
   private var _date:Date;
   
   private function init():void {
   _date = new Date();
   f1.text = _date.toString();
   f2.text = df.format(_date);
   }
   ]]
   /mx:Script
   mx:DateFormatter id=df formatString=MM/DD/YY HH:NN /
   mx:VBox
   mx:Text id=f1 /
   mx:Text id=f2 /
   /mx:VBox
 /mx:Application
 
 The output in the two fields shows:
 
 Tue Feb 26 16:16:32 GMT-0800 2008
 02/26/08 17:16
 
 Why does the date.toString show correct time, but the formatted date
 shows GMT-0700 instead? Don't they both use the client timezone?
 
 This is a pretty simple example, I would expect both outputs would 
be
 the same time (clients timezone).
 
 Any ideas?
 Thanks, Phil





[flexcoders] Re: DateFormatter and Date Timezone Issue

2008-02-26 Thread Phil Heinz
Thanks Doug - that was it. Sometimes you just can't see it even when
the answer is staring you in the face on the help page!

Thanks again, Phil