JodaTime - how to get current time in UTC

前端 未结 7 554
天命终不由人
天命终不由人 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)
    
    0 讨论(0)
提交回复
热议问题