I’m using the PHP function strtotime() to convert a MySQL Date datatype , formatted Y-m-d, to a Unix Timestamp so that I can compare this in Actionscript 3.
The strtotime() function works properly, for example, converting the string “2009-09-15” to the integer 1252987200. However, to compare this to the current time UTC stamp in actionscript 3, I’m using:
var now:Date = new Date();
…to get the current date, and:
…to get the Unix timestamp, however, now.time returns the integer 1252987200000, with 3 extra zeros.
…to get around this, I’ve just multiplied the php value by 1000, but there must be a better way to do this…
So…what is happending here? It seems the AS3 Date.time property is returning the number with milliseconds added to the overall value, or something like that? Or the 00:00:00 value as milliseconds, er something?
Probably I need to format the AS3 date before calling the time property or format the php date to include time? But, I’m not certain…er…