DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Flash Date Comparison

11.05.2007
| 5178 views |
  • submit to reddit
        // well it's flash ...
cmpDat = new Array(2007,   12,     2,    0,  0,   0);
/*                 year    mon     day   hr  min  sec
*/

function compareDates(cmpDat){
	var jd:Date = new Date();
	var zd:Date = new Date(cmpDat[0], cmpDat[1]-1, cmpDat[2], cmpDat[3], cmpDat[4], cmpDat[5], 0);
	if(zd.getTime()<jd.getTime()){
		return true;
			} else {
		return false;
	}
}
// the time is now? (true / false)
if(compareDates(cmpDat)){
	trace('ok das wars dann');
}