Posted By

chrisaiv on 04/07/08


Tagged


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

outbox
THEPWN3R
macKaminski


Compare Two Dates


 / Published in: ActionScript 3
 

URL: http://snippets.dzone.com/posts/show/4735

This should come in handy some day.

  1. cmpDat = new Array(2007, 12, 2, 0, 0, 0);
  2. /* year mon day hr min sec
  3. */
  4. function compareDates(cmpDat){
  5. var jd:Date = new Date();
  6. var zd:Date = new Date(cmpDat[0], cmpDat[1]-1, cmpDat[2], cmpDat[3], cmpDat[4], cmpDat[5], 0);
  7. if(zd.getTime()<jd.getTime()){
  8. return true;
  9. } else {
  10. return false;
  11. }
  12. }
  13. // the time is now? (true / false)
  14. if(compareDates(cmpDat)){
  15. trace('ok das wars dann');
  16. }

Report this snippet  

You need to login to post a comment.