如何在Java中获取格式为2022-10-03T19:45:47.844Z的日期和时间

Pra*_*bal 5 java iso8601 datetime-format simpledateformat offsetdatetime

我需要 java 类中 2022-10-03T19:45:47.844Z 格式的当前系统日期和时间。

我尝试使用 zoneddatetime 和简单日期格式,但无法从在线获取写入语法或代码。我是 Java 初学者,非常感谢任何帮助。谢谢。

Sha*_*mil 1

ZonedDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)