JodaTime - how to get current time in UTC

前端 未结 7 568
天命终不由人
天命终不由人 2020-12-14 01:12

I want to get the current time in UTC. What I do so far is following (just for testing purposes):

    DateTime dt = new DateTime();
    DateTimeZone tz = Dat         


        
7条回答
  •  遥遥无期
    2020-12-14 02:02

    You can also use the static method now which makes it even more readable

    DateTime.now(DateTimeZone.UTC)
    

提交回复
热议问题