Home › Forums › JavaScript › error Shop Open and Close Times script › Re: error Shop Open and Close Times script
September 28, 2010 at 2:53 pm
#78988
Bob
Member
t_hour == 9 is AM, since getUTCHours() returns the hour from 0-23. So 9 is still AM.
For 5:30PM, you could do the following:
var d = new Date();
var t_hour_minutes = d.getUTCHours() + ":" + d.getUTCMinutes();
if (t_hour_minutes > "17:30") {
document.write('closed');
}
Edit: I’m not really good with timezones and all that stuff, 5:30PM would seem 17:30 to me, but it might be 18:30 or so because of daylights saving.. I don’t know, but this should get you started.