converttime
– Convert Time Between Time Zones
The converttime
service can be used to convert
any time from UTC or any of the supported locations to any other of the
supported locations.
You have to specify a time stamp either in ISO8601 representation via the
iso
parameter, or you have to specify the individual components of the
time stamp. Skipped components will not yield an error message, but use a default value
instead (which corresponds to 01.01.2001, 00:00:00).
This service can be tested with the Query Builder.
Request Parameters.
Name | Description | Required |
---|---|---|
fromid |
Specify the ID of the location for which the supplied time stamp
corresponds. If the time stamp is in UTC, use the location id
Type: String/Location Id | Yes |
toid |
Specify the ID of the location(s) for which the time stamp should be converted. You can supply multiple locations by either providing them as comma separated list, or by repeating the parameter multiple times. There is a limit of maximum 25 locations per requests. Type: String/Location Id | No |
iso |
Time stamp in ISO8601 format. Type: String/ISO8601 Timestamp Example: 2011-06-08T09:18:16 Condition: either the | Conditional |
year |
Year component of the time stamp. Type: Integer Condition: either the | Conditional |
month |
Month component of the time stamp. Type: Integer Condition: either the | Conditional |
day |
Day component of the time stamp. Type: Integer Condition: either the | Conditional |
hour |
Hour component of the time stamp. Type: Integer Condition: either the | Conditional |
min |
Minute component of the time stamp. Type: Integer Condition: either the | Conditional |
sec |
Seconds component of the time stamp. Type: Integer Condition: either the | Conditional |
lang |
The preferred language for the texts. An error will be raised if the language code cannot be recognized. In case the text for a specific event cannot be retrieved in the requested language it will be returned in English instead. This is also the default language. In case you have specific needs for a certain language/translation, please email api@timeanddate.com. Type: String/ISO639 Language Code Default value: en NoteDue to technical limitations, time zone names cannot be translated at the moment. | No |
radius |
Search radius for translating coordinates (parameters
Type: Integer Default value: infinite (but only locations within the same country and time zone are considered) | No |
timechanges |
Add a list of time changes during the year to the
Type: Boolean Accepted values: Default value: | No |
tz |
Add time zone information under the Type: Boolean Accepted values: Default value: | No |
verbosetime |
Adds verbose time specification to all ISO 8601 time stamps. Type: Boolean Accepted values: Default value: | No |
See also the section called “General Parameters”.
Response Elements.
Name | Description |
---|---|
utc |
UTC time stamp of requested time. Type: UtcType |
location (XML), locations (JSON) |
This element contains the time information for the locations in the request. For the XML format, it will be repeated multiple times, while for JSON, it is modeled as an array of objects with the same content. Type: Array of LocationType |
Example JSON Request.
https://api.xmltime.com/converttime?fromid=750&toid=146&iso=2011-12-31T00:00:00;version=3&out=json&prettyprint=1&accesskey={KEY}&expires={TIMESTAMP}&signature={SIGNATURE}
Example JSON response
{ "version": 3, "billing": { "credits": 1 }, "utc": { "time": { "iso": "2011-12-30T13:00:00", "datetime": { "year": 2011, "month": 12, "day": 30, "hour": 13, "minute": 0, "second": 0 } } }, "locations": [{ "id": "750", "geo": { "name": "Lord Howe Island", "state": "Lord Howe Island", "country": { "id": "au", "name": "Australia" }, "latitude": -31.557, "longitude": 159.086 }, "matches": "source", "time": { "iso": "2011-12-31T00:00:00+11:00", "datetime": { "year": 2011, "month": 12, "day": 31, "hour": 0, "minute": 0, "second": 0 }, "timezone": { "offset": "+11:00", "zoneabb": "LHDT", "zonename": "Lord Howe Daylight Time", "zoneoffset": 37800, "zonedst": 1800, "zonetotaloffset": 39600 } } },{ "id": "146", "geo": { "name": "Maputo", "country": { "id": "mz", "name": "Mozambique" }, "latitude": -25.966, "longitude": 32.567 }, "time": { "iso": "2011-12-30T15:00:00+02:00", "datetime": { "year": 2011, "month": 12, "day": 30, "hour": 15, "minute": 0, "second": 0 }, "timezone": { "offset": "+02:00", "zoneabb": "CAT", "zonename": "Central Africa Time", "zoneoffset": 7200, "zonedst": 0, "zonetotaloffset": 7200 } }, "matchparam": "146" }] }
Example XML Request.
https://api.xmltime.com/converttime?fromid=750&toid=146&iso=2011-12-31T00:00:00;version=3&out=xml&prettyprint=1&accesskey={KEY}&expires={TIMESTAMP}&signature={SIGNATURE}
Example XML response
<?xml version="1.0" encoding="UTF-8"?> <data version="3"> <billing> <credits>1</credits> </billing> <utc> <time iso="2011-12-30T13:00:00"> <datetime> <year>2011</year> <month>12</month> <day>30</day> <hour>13</hour> <minute>00</minute> <second>00</second> </datetime> </time> </utc> <location id="750" matches="source"> <geo> <name>Lord Howe Island</name> <state>Lord Howe Island</state> <country id="au">Australia</country> <latitude>-31.557</latitude> <longitude>159.086</longitude> </geo> <time iso="2011-12-31T00:00:00+11:00"> <datetime> <year>2011</year> <month>12</month> <day>31</day> <hour>00</hour> <minute>00</minute> <second>00</second> </datetime> <timezone offset="+11:00"> <zoneabb>LHDT</zoneabb> <zonename>Lord Howe Daylight Time</zonename> <zoneoffset>37800</zoneoffset> <zonedst>1800</zonedst> <zonetotaloffset>39600</zonetotaloffset> </timezone> </time> </location> <location id="146" matchparam="146"> <geo> <name>Maputo</name> <country id="mz">Mozambique</country> <latitude>-25.966</latitude> <longitude>32.567</longitude> </geo> <time iso="2011-12-30T15:00:00+02:00"> <datetime> <year>2011</year> <month>12</month> <day>30</day> <hour>15</hour> <minute>00</minute> <second>00</second> </datetime> <timezone offset="+02:00"> <zoneabb>CAT</zoneabb> <zonename>Central Africa Time</zonename> <zoneoffset>7200</zoneoffset> <zonedst>0</zonedst> <zonetotaloffset>7200</zonetotaloffset> </timezone> </time> </location> </data>