Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Twitter API 中用于推文的时区是什么?
Twitter REST API 中推文的 created_at 字段提供了 UTC 时间戳。
如果用户使用 Twitter 配置了他们的时区,utc_offset 字段会为您提供他们的时区和 UTC 之间的秒数差异。所以,
"utc_offset":-28800
对应于 -28800/3600 = -8 小时 UTC。
有几个建议不针对夏令时进行调整。
每条推文的时区都会自动转换为本地时区。如果需要 UTC,可以使用 .ToUniversalTime() 方法,例如: myTweet.CreatedDate.ToUniversalTime();
myTweet.CreatedDate.ToUniversalTime();
时区位于交付选项下的用户设置中。
不幸的是,我认为这是不可能的。Twitter 不存储与本地时区相关的任何信息。我发现 user.utc_offset 始终为空。