Get time zone for a location on the earth, as well as that location's time offset from UTC. :param location: The latitude/longitude value representing the location to look up. :type location: string, dict, list, or tuple :param timestamp: Timestamp specifies the desired tim
(client, location, timestamp=None, language=None)
| 23 | |
| 24 | |
| 25 | def timezone(client, location, timestamp=None, language=None): |
| 26 | """Get time zone for a location on the earth, as well as that location's |
| 27 | time offset from UTC. |
| 28 | |
| 29 | :param location: The latitude/longitude value representing the location to |
| 30 | look up. |
| 31 | :type location: string, dict, list, or tuple |
| 32 | |
| 33 | :param timestamp: Timestamp specifies the desired time as seconds since |
| 34 | midnight, January 1, 1970 UTC. The Time Zone API uses the timestamp to |
| 35 | determine whether or not Daylight Savings should be applied. Times |
| 36 | before 1970 can be expressed as negative values. Optional. Defaults to |
| 37 | ``datetime.utcnow()``. |
| 38 | :type timestamp: int or datetime.datetime |
| 39 | |
| 40 | :param language: The language in which to return results. |
| 41 | :type language: string |
| 42 | |
| 43 | :rtype: dict |
| 44 | """ |
| 45 | |
| 46 | params = { |
| 47 | "location": convert.latlng(location), |
| 48 | "timestamp": convert.time(timestamp or datetime.utcnow()) |
| 49 | } |
| 50 | |
| 51 | if language: |
| 52 | params["language"] = language |
| 53 | |
| 54 | return client._request( "/maps/api/timezone/json", params) |