javascript - World time clock with DST support and server sync -
I want to include JavaScript World Time Clock on my homepage but I do not want to change it every time a time zone Is it possible to synchronize the DST changes with the official time server so that I can present the current time for different locations live and without any change after DST? Use standard functions with
.
$ timezones = array ("Australia / Brisbane", "America / New York", "Europe / London"); Foreign Currency ($ Tz as $ Time) {date_default_timezone_set ($ tz); The resonance is "Time at $ tz:". Date ('r'); }
This handles all daylight savings and everything for you.
You can find a list of timezones supported here:
Edit: Javascript implementation:
-
Use the above method to output to all the different timezones that are interested in PPP, but to get offset seconds from UTC,
date ('z')
Use. Use output using JSON or some so that JavaScript can be used by:var offsets = {'Brisbane': 36000, 'Sydney': 42000, 'London': 0} ;
-
Loop through all of them, essentially adding and subtracting the offset.
for
(different cities in off-city) {var d = new date (); D.setTime (d.getTime (+) + Offset [City] * 1000); Cautious ('' in the city '+' is' + d.toUTCString ()); }
-
Put the above mentioned in a function called every other set using the interface.
Comments
Post a Comment