【发布时间】:2021-10-16 14:15:38
【问题描述】:
2024-01-01T00:00:00.000Z
我想在 ms(long) 中得到这个字符串 我试过了:
long res = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").parse(createdAt).getTime();
但它不起作用。
【问题讨论】:
-
It doesn't work 不是错误描述。
-
您正在使用糟糕的日期时间类,这些类现在已经过时了。
Date和SimpleDateFormat几年前被 JSR 310 中定义的现代 java.time 类所取代。
标签: android-studio datetime simpledateformat iso8601