Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 875
Dray Avatar asked Aug 07 '12 14:08

Dray


1 Answers

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

like image 94
Jon Skeet Avatar answered Sep 29 '22 19:09

Jon Skeet