deltanovember
deltanovember

Reputation: 44051

How do I programmatically set the time zone in Java?

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.

Upvotes: 9

Views: 7337

Answers (1)

MetroidFan2002
MetroidFan2002

Reputation: 29878

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

Upvotes: 20

Related Questions