Since/Until date on javascript -



Since/Until date on javascript -

i want method since/until worried there're error when month has changed. don't want calculate when time left or passed.

my code:

var graduatedday = new date(); var day = graduatedday.getdate(); var month = graduatedday.getmonth() + 1; //(i plus 1 because month value 0-11) var year = graduatedday.getfullyear(); if ((day >= 15 && month >= 3) || (month > 4) && year >= 2015) { document.write("since today have graduated"); } else { document.write("you aren't graduated yet"); }

i don't sure above code given have concept that

why not compare date object?

var graduatedday = new date(); var x = new date('2013-03-15'); if (graduatedday > x) {document.write("since today have graduated")} else {document.write("you aren't graduated yet")}

i believe error might having in original code wrong (

if( day>=15 && month>=3 && year >= 2015 )

javascript date

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -