javascript - Convert system date into est time zone and compare two dates -
in application getting json have date string. have requirement comparing date current date , time in est timezone format. input date tue jun 23 2015 11:57:00 , current date should in same format in est time zone
i have compare both of those.
you can server time , compare yours
function converttoservertimezone(){ //est var offset = -5.0 var clientdate = new date(); var yourinputdate = new date("tue jun 23 2015 11:57:00"); var utc = clientdate.gettime() + (clientdate.gettimezoneoffset() * 60000); var serverdate = new date(utc + (3600000*offset)); var dateformated = serverdate.toisostring().substr(0,10); var dateformatedyourdate = yourinputdate.toisostring().substr(0,10); if(dateformated > dateformatedyourdate){ //here compare string values } }
Comments
Post a Comment