I’m trying to get the current unix timestamp in AS3 via:
var date:Date = new Date();
var unix:int = date.time;
trace(unix);
For some reason I get:
2775219874
But when I use time() in PHP around the same time, I get:
1321330282
I don’t understand?
I could of course request the timestamp from PHP via URLLoader, but I’d rather get it working properly without needing this if possible.
The issue in my question was being caused by assigning
date.timetointinstead ofNumber.See below for demo of assigning
date.timeto a variable: