Posted By

n00ge on 01/21/08


Tagged

sql time date


Versions (?)

SQL Date/Time Format


 / Published in: ActionScript
 

  1. var myDate:String = new String("");
  2. var today:Date = new Date();
  3. myYear = String(today.getFullYear());
  4. myDay = String(today.getUTCDate());
  5. if(myDay.length == 1) myDay = "0" + myDay;
  6. myMonth = String(today.getMonth() + 1);
  7. if(myMonth.length == 1) myMonth = "0" + myMonth;
  8. myHours = String(today.getHours());
  9. if(myHours.length == 1) myHours = "0" + myHours;
  10. myMinutes = String(today.getMinutes());
  11. if(myMinutes.length == 1) myMinutes = "0" + myMinutes;
  12. mySeconds = String(today.getSeconds());
  13. if(mySeconds.length == 1) mySeconds = "0" + mySeconds;
  14. myDate = myYear + "-" + myMonth + "-" + myDay + " " + myHours + ":" + myMinutes + ":" + mySeconds;

Report this snippet  

You need to login to post a comment.