How do I get a user's date/time or timezone information for an Alexa Skill?

孤街浪徒 提交于 2019-12-19 09:09:56

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!