Ok, this just drove me nuts for a few minutes..
I’m getting the server time UNIX formatted, I was constantly trying to convert the integer to a readable date, constantly getting the wrong year (the default or zero unix year is 1970) but aren’t we living in 2009?
So for future reference and for anyone that might be searching for this.
Unix time is seconds based, Flash time is milliseconds based. got it?
So anytime you get a unix time integer you just need to multiply by 1000 to get the correct time for your Flash project.
Example:
GOOD CODE
curDate = new Date(Number(dateXML.int * 1000));
BAD CODE
curDate = new Date(Number(dateXML.int));

The AS3: quick hint – Converting int to date by Tiago's Weblog, unless otherwise expressly stated, is licensed under a Creative Commons Attribution 2.5 Switzerland License.




0 Comments.