I am trying to set a specific time to two variables but can't seem to correctly format the syntax. I want to be able to set Shift 1 and Shift 2 off of certain times indicated below.
I want to only be able to use these times in an IF statement so that a radio button can be checked by default. Day Shift button and a Night Shift button. If the current time is in between shift 1, then day shift button is checked.
Date.prototype.currentTime = function(){ return ((this.getHours()>12)?(this.getHours()-12):this.getHours()) +":"+ this.getMinutes()+((this.getHours()>12)?('PM'):'AM'); }; var d1= new Date(); var d2 = new Date(); d1.setHours(7); d1.setMinutes(10); d2.setHours(19); d2.setMinutes(10); alert(d1.currentTime()); alert(d2.currentTime()); Any help is appreciated.