How to programmatically set timezone in Java?

I know that I can supply VM arguments as follows

-Duser.timezone="Australia/Sydney"

Is there a software way to make an equivalent? I would like this parameter to be applied on the whole virtual machine.

+5
source share
1 answer

java.util.TimeZone.setDefault()can be used to set the default time zone for getDefault().

+12
source

All Articles