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.
有什么解决方案,我使用时区,例如美国,或 RUS...timestamp吗?因为timestamp.now()总是让我获得当地时间取决于设备上的时钟
timestamp
timestamp.now()
以下是根据日期获取时间戳的示例方法。
DateTime.now().timeZoneName,给你时区,例如BST
DateTime.now().timeZoneName,
DateTime.now()给你时间从你的本地设备 2020-04-29 16:35:25.138
DateTime.now()
2020-04-29 16:35:25.138
DateTime.now().toUtc()为您提供日期时间 UTC 协调世界时2020-04-29 15:35:25.139Z
DateTime.now().toUtc()
2020-04-29 15:35:25.139Z