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 + ")");
Comments
Post a Comment