How do I programmatically set the time zone in Java?

假装没事ソ 提交于 2019-12-23 07:36:46

问题


I know I can feed VM arguments as follows

-Duser.timezone="Australia/Sydney"

Is there a programmatic way to do the equivalent? I would like the setting to be applied across the entire virtual machine.


回答1:


java.util.TimeZone.setDefault() can be used to set a default time zone to be returned by getDefault().



来源:https://stackoverflow.com/questions/7630753/how-do-i-programmatically-set-the-time-zone-in-java

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!