Dray
Dray

Reputation: 1954

How to convert a String to TimeZone : Android

I am having a String myString = "Asia/kolkata";

I need to set TimeZone.setDefault(myString);

I have tried as mentioned above. But String cannot be given in TimeZone parameter.

How to set this?

Upvotes: 5

Views: 5657

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1500675

You use TimeZone.getTimeZone(String) to get the time zone, then you can set that as the default.

Upvotes: 11

Related Questions