Time Zone API
Use this API to get time zone information for the specified location’s geocode (latitude and longitude) value based on the configured default map provider.
API Definition
This API is defined in the MapProviderManager class.
public static ResultObject retrieveTimezoneInfo(String latitude, String longitude)
Parameters
Name
Required
Description
latitude
Yes
Latitude of a location.
longitude
Yes
Longitude of a location.
Response Attributes
The return type is resultObject, which defines the information that is included in the response for this API.
Name
Description
status_code
Status code of the API response. For more information, see Time Zone API Response Status Codes below.
status_message
Status message of the API response.
timezone_info
Time zone information in JSON format.
timezoneId
ID of the time zone, for example, America/Los_Angeles or Australia/Sydney.
timezoneName
Long-form name of the time zone.
dstOffset
Offset for Daylight Savings Time in seconds. Value is 0 if the time zone is not in Daylight Savings Time during the specified timestamp.
rawOffset
Offset from UTC (in seconds) for the specified location. Daylight Savings Time is not considered.
* 
Keep in mind that the timezoneName, dstOffset and rawOffset attributes can be empty, so for best results, do not rely on those values.
Response Example
{
"status_message": "Success",
"status_code": 0,
"timezone_info": {
"timezoneId": "America/Los_Angeles",
"timezoneName": "Pacific Daylight Time",
"dstOffset": "3600",
"rawOffset": "-28800"
}
}
Time Zone API Response Status Codes
Code
Message
Description
0
Success
Request successful. Time zone information returned.
1
Request success but no result return.
Request successful. No time zone data found for specified location or time, therefore no results returned.
3
Invalid request
Null, empty, or invalid latitude or longitude parameter. Latitude and longitude values must be numbers in String format, with a latitude scope of –90 to 90 and longitude scope of –180 to 180. For example, addressKeyword = "", latitude = "100" causes this error.
4
No default map provider specified in current setting.
No default map provider configured in the active system setting.
5
Invalid API Key.
Specified API key is invalid.
6
Invalid signature or client id.
Specified signature value is invalid for the specified client ID, or the specified client value is invalid.
7
Request over query limit.
Request exceeds the query quota.
8
Unable to authenticate the request.
Unsuccessful request caused by a map provider server authentication issue.
9
Current map provider is not supported.
Current map provider not supported for the Time Zone API. At this time, only Google and OpenStreetMap are supported.
101
Server Internal Error.
Server internal errors occurred on the map provider server.
102
Unknown error.
Other unknown errors returned from the map provider server.
Example
import com.servicemax.mapproviders.MapProviderManager

def res = MapProviderManager.retrieveTimezoneInfo("37.3893889","-122.0832101");
* 
At this time, this API is supported only for Google Maps and OSM/MapBox.
Reference
For more information:
Was this helpful?