Twitter - 推文的时区

发布于 2024-10-07 18:20:56 字数 30 浏览 0 评论 0原文

Twitter API 中的推文使用哪个时区?

What is the time zone used for tweets in Twitter API?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

人间不值得 2024-10-14 18:20:56

Twitter REST API 中推文的created_at 字段提供UTC 时间戳。

如果用户已使用 Twitter 配置了他们的时区,则 utc_offset 字段将为您提供他们的时区和 UTC 之间的秒数差异。因此,

"utc_offset":-28800

对应于 UTC 的 -28800/3600 = -8 小时。

一对建议,这不会根据夏令时进行调整。

The created_at field for a tweet in the Twitter REST API gives the timestamp in UTC.

If a user has configured their timezone with Twitter, the utc_offset field gives you the difference in seconds between their timezone and UTC. So,

"utc_offset":-28800

corresponds to -28800/3600 = -8 hours from UTC.

There are a couple of suggestions that this doesn't get adjusted for daylight savings.

自由范儿 2024-10-14 18:20:56

每条推文的时区都会自动转换为本地时区。如果需要UTC,可以使用.ToUniversalTime()方法,例如:
myTweet.CreatedDate.ToUniversalTime();

The timezone of each tweet is automatically converted to the local timezone. If you need UTC, you can use the .ToUniversalTime() method, for example:
myTweet.CreatedDate.ToUniversalTime();

情话已封尘 2024-10-14 18:20:56

时区位于交付选项下的用户设置中。

Time zone is in the user settings under delivery options.

戴着白色围巾的女孩 2024-10-14 18:20:56

不幸的是,我认为这是不可能的。 Twitter 不存储任何与本地时区相关的信息。我发现 user.utc_offset 始终为空。

Unfortunately, I think It is impossible. Twitter does not store any information related to local timezone. I found that user.utc_offset are always null.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文