How to set java timezone?

前端 未结 6 1379
囚心锁ツ
囚心锁ツ 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:14

    This code helped me.

    TimeZone tzone = TimeZone.getTimeZone("Singapore");
    // set time zone to default
    tzone.setDefault(tzone);
    

提交回复
热议问题