Posted By

MarioSantos on 02/08/11


Tagged

date unix timestamp convert


Versions (?)

Convert date to unix timestamp string


 / Published in: ActionScript 3
 

Simple as this! var nowunixtimestamp:String = convertToUnix(new Date());

  1. public function convertToUnix(value:Date):String {
  2. var currentDate = value.date;
  3. var currentMonth = value.month;
  4. var currentYear = value.fullYear;
  5. var dt:Date = new Date(currentYear, currentMonth, currentDate + 1);
  6. return Math.round(dt.getTime()/1000).toString();
  7. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: JaaQ on June 18, 2011

value.getTime() does the same thing..

You need to login to post a comment.