I am working on a project where i need to SHOW the visitor of the website a message in the contacts area like:
Contact no: +91-99-3241-5285 [You can call us now]
The message is highlighted in the above line, now my question is, how to compare the user’s time zone with the working hours of the company’s office.
P.S. – Suppose the company is in INDIA, and its working hours are 9.00am to 5.00pm.
Any suggestions?
Use javascript to determine the users timezone offset:
http://www.w3schools.com/jsref/jsref_gettimezoneoffset.asp
Then calculate e.g. the current time in INDIA (GMT + 5:30 if i’m not wrong) and show “you can call us now” if the resulting time is within the working hours.
See the working demo at: http://jsfiddle.net/roberkules/RLsw9/