timezone - JavaScript: Multi Time Zones Clocks -
i want display 3 clocks 3 different time zones using javascript. browsed around web searching simple solution found long scripts , .js extensions, finish simple task.
is there easy way this? have add together additional js file finish task?
thanks in advance helpers!
is there easy way this?
yes.
do have add together additional js file finish task?
no. however, time handling in js difficult, since has no cross-browser-safe date/timestring parsing , formatting methods. can helpful utilize library that, won't necessary clock.
// 3 clocks represent current time var clock1 = new date(); // current moment var clock2 = new date(); var clock3 = new date(); // outputting, adjust them // leave clock1 in utc clock2.sethours(clock2.gethours() + 3); // utc+3 clock3.sethours(clock3.gethours() - 5); // utc-5 // display, utilize these values: clock1.getutchours(); clock1.getutcminutes(); clock1.getutcseconds(); clock2.getutchours(); clock2.getutcminutes(); clock2.getutcseconds(); clock3.getutchours(); clock3.getutcminutes(); clock3.getutcseconds();
javascript timezone clock
No comments:
Post a Comment