How to set java timezone?

前端 未结 6 1391
囚心锁ツ
囚心锁ツ 2021-01-05 11:53

My system time differs from what java\'s new Date() tells (+ 4 hours),
so I think it\'s because some java settings.
How can I make java time to be always as my linu

6条回答
  •  情话喂你
    2021-01-05 12:09

    You can use TimeZone.setDefault(..) when your application starts, or pass the timezone as command-line argument: -Duser.timezone=GMT

提交回复
热议问题