Using Joda time to get current wall time for a given Time Zone

前端 未结 3 738
深忆病人
深忆病人 2021-02-02 16:24

The requirement is to simply to get the current wall time (including the correct DST adjustment) for a given Time Zone.

There seems to be a few questi

3条回答
  •  遥遥无期
    2021-02-02 17:14

    How about:

    DateTime utc = new DateTime(DateTimeZone.UTC);
    DateTimeZone tz = DateTimeZone.forID("America/Los_Angeles");
    DateTime losAngelesDateTime = utc.toDateTime(tz);
    

提交回复
热议问题