简单日期格式 DateTime 在不同的 Android 设备中给出不同的结果
fun getDateTimeWithUTC(): String {
val df = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
df.timeZone = TimeZone.getTimeZone("UTC")
return df.format(Date())
}
此代码从不同的设备给出了不同的结果..:
错误格式:31-03-2022-20:08:02
期望:2022-03-31T18:07:23.607000000Z
为什么?
fun getDateTimeWithUTC(): String {
val df = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
df.timeZone = TimeZone.getTimeZone("UTC")
return df.format(Date())
}
this code gives different results from different devices.. :
wrong format : 31-03-2022-20:08:02
expect : 2022-03-31T18:07:23.6070000Z
Why ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论