【发布时间】:2015-04-02 20:33:51
【问题描述】:
给定以下 UTC 时间:
2009-11-17 10:45:32
我怎样才能创建一个具有确切时间的org.jode.time.LocalDateTime,但使用UTC?
换句话说,该时间戳表示 UTC 时间。我想在joda 中创建一个新的 Timestamp 对象,该时间为 UTC。
我尝试了以下失败:
scala> org.joda.time.LocalDateTime.parse("2009-11-17 10:45:32",
org.joda.time.format.ISODateTimeFormat.tTime)
java.lang.IllegalArgumentException: Invalid format: "2009-11-17 10:45:32"
【问题讨论】:
-
"2009-11-17 10:45:32" 不是 UTC 时间 - 它没有指定 any 偏移量。它只是指定的
LocalDateTime。我根本不知道时区与这个问题有什么关系......
标签: timezone timestamp jodatime