flex3 - convert UTC time to date time format in flex? -


how convert utc time date time format in flex. using sdk 3.5. example have current date time in utc format 1309522586000 (milliseconds) , want convert friday jul 1 2011. how can this??

thanks

if using unix timestamp retrieving server, first have multiply 1000.

this because unix timestamps expressed in seconds whereas actionscript timestamps expressed in milliseconds.

you can create date timestamp follows:

var mydate:date = new date(1309522586000); 

next, create formatdate function call mydate parameter:

    <fx:declarations>     <!-- place non-visual elements (e.g., services, value objects) here -->     <mx:dateformatter id="mydf" formatstring="eeee mmm d yyyy"/> </fx:declarations> <fx:script>     <![cdata[         private function formatdate(date:date):void{             trace(mydf.format(date));         }     ]]> </fx:script> 

notice using dateformatter format date correctly.

more dateformatter , possible formats here: http://help.adobe.com/en_us/flashplatform/reference/actionscript/3/mx/formatters/dateformatter.html

cheers


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -