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.
次のことを想像してください。
私はアゾレスでこの日付を持っています (GMT -1) 23/10/2010 23:00:00
そして、この日付を次の日付に変換したい(GMT +1)
2010/10/24 01:00:00
任意のタイムゾーンの任意の日付に対してこの動作が必要であり、タイムゾーンを使用した Date 関数は、この場合に GMT -1 を提供します。
私は JodaTime を使用していることに注意してください。
ありがとう。
DateTime dateTime = new DateTime(2010, 10, 23, 23, 0, 0, 0, DateTimeZone.forOffsetHours(-1)); // (GMT -1) 23/10/2010 23:00:00 DateTime inAnotheTimeZone = dateTime.withZone(DateTimeZone.forOffsetHours(1));