I have some code that checks if a user falls within a specific time (9.00am - 17.30pm) Monday to Friday.
function checkTime() {
var d = new Date(); // current time
var hours = d.getHours();
var mins = d.getMinutes();
var day = d.getDay();
return day >= 1
&& day <= 5
&& hours >= 9
&& (hours < 17 || hours === 17 && mins <= 30);
}
This is working correctly but it checks the time based on the users browser time.
What I want to do is have it check 9.00am - 17.30pm UK Time Only.
So if you are viewing the site/script from America at say 10.00am (UTC-7) you would be outside of the time checker because it would be 18.00pm (UTC+1) UK time.
So I guess what I'm trying to do is get the users timezone and then convert it to UK time and then run my checkTime()
script?