We Recommend

Essential ActionScript 3.0 Essential ActionScript 3.0
The book focuses on the core language and object-oriented programming, but also adds a deep look at the centerpiece of Flash Player's new API: display programming. Enjoy hundreds of brand new pages covering exciting new language features, such as the DOM-based event architecture, E4X, and namespaces--all brimming with real-world sample code.


Ballyhoo


Posted By

chrisaiv on 04/07/08


Tagged


Versions (?)


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.