Compare Two Dates


/ Published in: ActionScript 3
Save to your folder(s)

This should come in handy some day.


Copy this code and paste it in your HTML
  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. }

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.