expressionengine - How to compare 2 dates in different format (javascript) -


i using expression engine , put date field in javascript variable, parses :

1435269960 

so want check if date earlier today or not. when create date object , console.log(date) shows me kind of date :

wed jul 01 2015 18:14:33 gmt-0400 (eastern daylight time) 

how change format first one?

thx!

you so:

var datenumber = 1435269960; var converteddate = new date(1000*datenumber); var today = new date();  if(converteddate < today)     $(".date").html("the date in past<br/><br/>" + converteddate + "<br/>vs<br/>" + today); else $(".date").html("the date today or in future<br/> (" + converteddate + ") vs (" + today + ")"); 

demo: http://jsfiddle.net/db9ms49z/


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -