I am having problems with this script. I'm trying to get it to display a document write on the website if the time is as specified and the day is.
These are the times and days i want to display for:
Monday: CLOSED
Tuesday: 9AM - 5:30PM
Wednesday: 9AM - 5:30PM
Thursday: 9AM - 5:30PM
Friday: 8AM - 2PM
Sunday: CLOSED
At the moment this script only writes for
Monday to Friday, 8:30am to 6pm (GMT0).
But as you can see from my times above i want to be able to show two unique times for 2 days tues-thurs and friday (open) / sat-sun (close).
i assume the else statement would be used for both monday and sunday as it writes close?
I have no clue how to go about this, tried changing the the t_day but had no success
Code JavaScript:var d = new Date(); var t_hour = d.getUTCHours(); // getUTC for GMT0 var t_min = d.getUTCMinutes(); var t_day = d.getUTCDay(); if (t_hour == 8 && t_min >= 30 && t_day > 0 && t_day <=5) { document.write('open'); } else if (t_hour > 8 && t_hour < 18 && t_day > 0 && t_day <=5) { document.write('open'); } else { document.write('closed.'); }
To declare the script in my html doc i've just used
<script src="js/open.js" type="text/javascript"></script>
If anyone can help me with getting the times and dates as stated above working that would be greatly appreciated
Regards
Whytey








Bookmarks