Help, need to integrate world time zone on my program using JavaScript

Asked By 10 points N/A Posted on -
qa-featured

Hi, I am developing a program and I want to base the time on a world time zone online to always come up with the correct time update unlike on the users computer time that has always the possibility of wrong time output if not set correctly. Any best JavaScript solution for this?

SHARE
Answered By 35 points N/A #153757

Help, need to integrate world time zone on my program using JavaScript

qa-featured

Hi,

You can use the Javascript date object to return the time difference between UTC and Local Time.

The get.TimezoneOffset() method returns the time difference between UTC and local time in minutes. You can use it like

Var d = new date();

Var n = d.getTimezoneOffset();

If your timzone is GMT +2 then -120 will be returned.

Note UTC time is the same as GMT.

Regards,

Related Questions