Hi, I need to get the UNIX timestamp from when the day started in AS3. How can I do this???
Thanks in advance :)
Hi, I need to get the UNIX timestamp from when the day started in AS3. How can I do this???
Thanks in advance :)
oh, well I found out a way.
var time:Number;
var timestamp:Number = 1283297261; // Should be unix timestamp, divide by 1000 if its a microsecond timestamp.
time = Math.min(timestamp / 86400);
time = answer*timestamp;
Or you could use a 'Date' object... Date is a globally defined intrinsic class/type in AS3 so you don't need to import anything to be able to use it.
var today:Date = new Date(); // constructor sets a new Date object to the current system date/time by default
var current_time:number = today.valueOf(); // valueOf returns the number of milliseconds since midnight on january 1st 1970 (universal time!)
The Date class has loads of different options to return the date in various formats.
I think valueOf() is most likely the one you're after. Otherwise take a look at the documentation for the Date class. I'm sure you'll find a function in there that will suit your needs!
Cheers for now,
Jas.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.