tzmatt7447
tzmatt7447

Reputation: 2399

Is there a publicly available API that does time zone conversion?

Does anyone provide an 3rd party API that does time zone conversions? I'm thinking of doing it for a site, just to make it easier to handle all the intricacies. It is a multi-zone scheduling kind of applicaiton and time zones need to be handled perfectly.

I dont think timeanddate.com does it, but does anyone else? Reliabily?

Upvotes: 0

Views: 3093

Answers (4)

Saffws
Saffws

Reputation: 1

While googling I found this API Service- www.timezdb.com. It just takes parameters as latitude, longitude, city name, state, country name. I don't know what exactly you require, but just you can visit and see if it could solve your purpose.

Upvotes: 0

Amy B
Amy B

Reputation: 17977

Something I made a while ago gives you all timezones, their current time, and if DST is active there or not:

http://api.coronatus.com/clock/read

You can use the utc_offset field to do timezone conversions.

Upvotes: -1

deceze
deceze

Reputation: 522513

I really want a simple function where I give it a certain time and date (in a timezone) and tell it what timezone I want it in - and it should give me the exact date and time in the target zone! Yes of course this is possible internally, but I fear getting it wrong!

Then you need to test, test and test more. If you're outsourcing because you're afraid of programming you should just buy some software. ;P

The function itself is simple enough.

http://php.net/manual/en/datetime.settimezone.php

function convertTimeZone($time, $origin, $target) {
    $date = new DateTime($time, new DateTimeZone($origin));
    $date->setTimezone(new DateTimeZone($target));
    return $date->format('Y-m-d H:i:s');
}

echo convertTimeZone('2000-01-01 00:00:00', 'Pacific/Nauru', 'Pacific/Chatham');

Upvotes: 1

Rick
Rick

Reputation: 17013

I found a few just searching on google, such as this one:

http://worldtimeengine.com/api/instructions

There seem to be some for a variety of languages, it depends on your need I guess as I'm not sure if you are trying to do it based on city or what

Upvotes: 1

Related Questions