Skip to content
BestAstroAPI

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 lat and lon, the zone of the nearest known place is used; nearest tells you which.
  • Close to a border, send a place instead.

Request

Send these in the query string.

FieldTypeDescription
placestringPlace name. Send one of: place, place_id, lat and lon, or tz
place_idintegerThe id of a place from place search
latnumberLatitude, with lon
lonnumberLongitude, with lat
tzstringIANA zone or offset
datetimestringLocal 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"

Try it live

Sends a real request from your browser.

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.
FieldTypeMeaning
placePlaceUsedThe place we looked up. Only when you sent place or place_id optional
nearestobjectThe place whose zone was used. Only when you sent lat and lon optional
nearest.idintegerIts id
nearest.labelstringIts name with state and country
nearest.distance_kmnumberkmDistance to it
tzstringIANA zone, or the offset you sent
datetimestringLocal time used
utc_offsetstringUTC offset in force then, for example +05:30
offset_hoursnumberhoursThe same in hours, for example 5.5
dstbooleanTrue in summer or war time
utcstringISO 8601The 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.

FieldTypeMeaning
idintegerStable id
namestringName
labelstringName 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.

Welcome! How will you use it?

We'll show you what matters to you. You can switch any time at the top.