Joda Time - different between timezones

前端 未结 2 1144
梦谈多话
梦谈多话 2020-12-10 14:23

I want to convert the current time to the time in a specific timezone with Joda time.

Is there a way to convert DateTime time = new DateTime() to a spec

2条回答
  •  抹茶落季
    2020-12-10 15:02

    Check out DateTimeZone & Interval:

    DateTime dt = new DateTime();
        // translate to London local time
        DateTime dtLondon = dt.withZone(DateTimeZone.forID("Europe/London"));
    

    Interval:

    Interval interval = new Interval(start, end); //start and end are two DateTimes
    

提交回复
热议问题