Places & time zones
Time zone
GET/v1/timezone
Time zone and UTC offset in force at a place on a date.
- Includes summer time and India's war time (1942 to 1945).
- With
latandlon, the zone of the nearest known place is used;nearesttells you which. - Close to a border, send a place instead.
Request
Send these in the query string.
| Field | Type | Description |
|---|---|---|
| place | string | Place name. Send one of: place, place_id, lat and lon, or tz |
| place_id | integer | The id of a place from place search |
| lat | number | Latitude, with lon |
| lon | number | Longitude, with lat |
| tz | string | IANA zone or offset |
| datetime | string | Local date, or date and time. Default: now |
Example
curl -X GET "https://api.bestastroapi.in/v1/timezone?place=New%20Delhi&datetime=2004-05-18T10:30" \
-H "x-api-key: $BESTASTRO_KEY"Response
[]is a list.{key}is a key that varies.- An optional field can be missing. That means it does not apply.
- Times carry the UTC offset of the place. A time after midnight has the next date.
| Field | Type | Meaning |
|---|---|---|
| place | PlaceUsed | The place we looked up. Only when you sent place or place_id optional |
| nearest | object | The place whose zone was used. Only when you sent lat and lon optional |
| nearest.id | integer | Its id |
| nearest.label | string | Its name with state and country |
| nearest.distance_km | numberkm | Distance to it |
| tz | string | IANA zone, or the offset you sent |
| datetime | string | Local time used |
| utc_offset | string | UTC offset in force then, for example +05:30 |
| offset_hours | numberhours | The same in hours, for example 5.5 |
| dst | boolean | True in summer or war time |
| utc | stringISO 8601 | The same moment in UTC |
Objects used above
PlaceUsed A place that was looked up for you. Show its label, so the user can check it.
| Field | Type | Meaning |
|---|---|---|
| id | integer | Stable id |
| name | string | Name |
| label | string | Name with district or state and country |
Raw sample
200 application/json
{
"datetime": "2004-05-18T10:30:00",
"dst": false,
"offset_hours": 5.5,
"place": {
"id": 1261481,
"label": "New Delhi, Delhi, India",
"name": "New Delhi"
},
"tz": "Asia/Kolkata",
"utc": "2004-05-18T05:00:00Z",
"utc_offset": "+05:30"
}Real output for the example request above.
Errors use one format. See error codes. Also in openapi.json.