I'm working on a little project for a small business website and I found a helpful tutorial for a script. The script will show an open or closed sign depending on the current time I changed a couple of things but now it's working just fine, except for one small thing...
The time setting they use is wrong. I live in the Netherlands, and the timezone here is UTC+1. The javascript is working on UTC.
This is the code
localTime=new Date();
utc1Time=new Date(localTime.getTime() + (localTime.getTimezoneOffset() + 120) * 60000);
hours=utc1Time.getHours();
minutes=utc1Time.getMinutes();
today=utc1Time.getDay();
Now I'm wondering what the code should be to get the correct timezone. And just so you know, I'm new to Javascript. Thanks in advance!
edit:
this is an example how I use the time so show the diffrent sign
if (today==6) {
if (hours>=1&&minutes>=4) {
if (hours<=23&&minutes<=30) {document.write(statusopen);
}
else {document.write(statusclosed);
}
}
else {document.write(statusclosed);
}
}