In joda time how to convert time zone without changing time
Solution 1:
You can use class LocalDateTime
LocalDateTime dt = new LocalDateTime(t.getTime());
and convert LocalDateTime
to DateTime
DateTime dt = new LocalDateTime(timestamp.getTime()).toDateTime(DateTimeZone.UTC);
Joda DateTime
treats any time in millis like "millis since 1970y in current time zone". So, when you create DateTime
instance, it is created with current time zone.
Solution 2:
You can use the withZoneRetainFields()
method of DateTime
to alter the timezone without altering the numerals in the date.