22
Jan/102
Jan/102
Unix Timestamp in Flash
Recently i needed to convert normal Time to Unix Timestamp in Flash. I couldn't get how to go about it intially. But when i gone through the definition of Unix Timestamp, its was clear for me.
"The unix time stamp is a way to track time as a running total of seconds. This count starts at the Unix Epoch on January 1st, 1970. Therefore, the unix time stamp is merely the number of seconds between a particular date and the Unix Epoch."
In order to count the number of seconds till a time, we have method Date.getTime() in Flash. This will effectively return the number of seconds from the Unix Epoch till the Date.
This is how i tried to find out the number of seconds till today's System Time:
var myDate = new Date();
trace(myDate);
var unixTime = Math.round(myDate.getTime()/1000);
trace("Unix Time: "+unixTime);
Output:
Fri Jan 22 13:01:55 GMT+0530 2010 Unix Time: 1264145516
Recent Comments
Archives
- March 2010 (1)
- February 2010 (3)
- January 2010 (1)
- December 2009 (15)
- November 2009 (24)
- October 2009 (22)
- September 2009 (24)
- August 2009 (3)
Categories
- Adobe (6)
- Adobe Dreamweaver (1)
- Adobe Illustrator (1)
- Tutorials (1)
- AIR (13)
- Apple (4)
- Applications (2)
- IPhone (1)
- CSS (4)
- Flash (39)
- FL for Digital Home (5)
- Flash Components (2)
- FlashLite (5)
- News (1)
- Websites (2)
- Flash Catalyst (2)
- Flex (9)
- Google (2)
- Icons (1)
- Microsoft (1)
- Photoshop (13)
- Security (1)
- Wordpress (2)
Tags
ActionScript 3.0
Adobe
Adobe Flash
Adobe Flash Platform
Adobe Flex
Adobe labs
Adobe Photoshop
Adobe TV
AIR
AIR 2.0
APE
Apple
AppStore
AS3
Brushes
Components
CS4
CSS
Design
Digital Home
Dragable Rectangle Particle
Drag and drop
dragEnabled
dropEnabled
EDGE Newsletter
Flash
Flash CS4
FlashLite
Flash Lite
Flashlite for Digital HOme
FLDH
Flex
Google
Icons
InsideRia
IPhone
List
MAX 09
Microsoft Silverlight
Photoshop
RIA
set-top box
Skinning
Smashing magazine
Tutorials