Javascript - setHours() for cookie not working -


i creating cookie expires @ 4 pm each day. have sethours() function supposed set cookie's expiration time 16:00:00 pm instead sets hours 12:00:00 pm. tell me why doing this? code used below:

var date = new date(); var expire = new date();  // check if time before midnight after blackout if (date.gethours() >= 16 && date.gethours() <= 23) {     expire.setfullyear(date.getfullyear());     expire.setmonth(date.getmonth());     expire.setdate(date.getdate()+1);     expire.sethours(16);     expire.setminutes(0); }  // check if time after midnight before blackout else if (date.gethours() >= 0 && date.gethours() < 11) {     expire.setfullyear(date.getfullyear());     expire.setmonth(date.getmonth());     expire.setdate(date.getdate());     expire.sethours(16);     expire.setminutes(0); }  // create disabled order cookie document.cookie = "orderdisabled=true; expires=" + expire.tostring() +"; path=/"; console.log(expire.tostring()); 


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -