Twitter timezone & created_at (utc time) values to calculate what time zone the user is in

偶尔善良 提交于 2019-11-30 09:43:27
arcain

This answer details how to convert a Twitter date into something PHP can work with; synopsis below.

strtotime("dateString"); gets it into the native PHP date format, then you can work with the date() function to get it printed out how you'd like it.

As for the time zone, you can use the value of the utc_offset property of the user object to calculate it. For example, my profile's utc_offset is:

"utc_offset":-21600

Just divide that value by 3600 and that will give you -6, which is the US Central time zone. These will be absolute offsets and will not change whether the time zone honors daylight savings time.

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