简体   繁体   English

给定一个DateTime对象,如何在Joda Time中获取DateTimeZone?

[英]Given a DateTime object, how do I get DateTimeZone in Joda Time?

As the title describe, if I have a DateTime object in JodaTime: 如标题所述,如果我在JodaTime中有一个DateTime对象:

import org.joda.time.DateTime

val currentDateTime = new DateTime()

the variable currentDateTime should give me the date and time in my local timezone. 变量currentDateTime应该为我提供本地时区的日期和时间。

How do I get the DateTimeZone of currentDateTime from here? 如何从此处获取currentDateTimeDateTimeZone

调用getZone()方法:

currentDateTime.getZone()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM