/    Sign up×
Community /Pin to ProfileBookmark

Converting local time to your time

I’m looking for a script or some help converting local times to the users time.

I have a calendar which displays the times of local races, such as Italy, how do I add a button to convert that time into the users local time. Instead of adding in hundreds of different times specific to different zones, it’d be so much easier for a script to recognise the location and convert it automatically.

Does anyone know of anything that will do this?

Thanks in advance.

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@opifexSep 12.2009 — If the times in your calendar are all "set" in the same time zone - UTC for example you can covert it automatically to the time zone set on the client computer using the JavaScript Date Object.

You just need to compare the RaceTime TZ to the LocalTZ..... of course if the client machine is set to UTC (as many are), you won't return the client TZ.

You might be better off going server side and pulling the TZ of the IP to make a comparison before sending the data.
Copy linkTweet thisAlerts:
@TheF1TimesauthorSep 12.2009 — The times are set to local race times, i.e. The race in Italy is set on Italian time, the race in Japan, set to Japanese times.

So if a user in the UK looks at the times, they see the Italian times, but can then choose to see them in their local time (UTC/GMT).

I believe the F1.com site does this, but can't figure out how.
Copy linkTweet thisAlerts:
@opifexSep 16.2009 — easiest way is to use php server side to do this...

either translate TZ automatically by IP or by selecting an option.
Copy linkTweet thisAlerts:
@opifexSep 16.2009 — I looked at the f1times site... they don't do anything.... times are static - local time and UK time
×

Success!

Help @TheF1Times spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...