问题
I'm using Lambda (Python) to develop a skill and I'm interested in giving the user some time-related information. On the request
object there is a timestamp
but that is UTC without offset. Is there a way to find the user's date/time or timezone without having to ask for location information (and if that's the only way, do you know of a database of US zip codes to timezone or another workaround?).
回答1:
It is now possible to get the user's timezone using the Alexa Settings API. See the related blogpost for official information about this feature's release.
The endpoint you'll be interested in is the following:
GET /v2/devices/{deviceId}/settings/System.timeZone
You simply need to provide the user's device ID, which is part of the received intent. The response will contain a timezone name, for instance "Europe/London".
来源:https://stackoverflow.com/questions/44072625/how-do-i-get-a-users-date-time-or-timezone-information-for-an-alexa-skill