Hello I am using Twitter REST API to call the home_timeline for timelines.
But I found that the object it returned had the created_at
with GMT+0 timezone, how can I adjust the timezone to the user’s local timezone for example GMT+8?
Here is the original data with GMT+0 from Twitter API:
Wed May 04 16:23:13 +0000 2016
2
Answers
what’s the expected output format?
you can try:
if you expect a specific output format, you can use http://momentjs.com/timezone/ , to change both the timezone and format
I’m highly recommend to use MomentJS timezone library.
Furthermore, I’m recommend not to use GMT+8 label for time shifting, and use, for example, “Asia/Shanghai” instead. I would save hours to debug for you.
So, code barebone look like:
Output would be something like
"20160505 12:23:13"
.Thanks!