I am getting a date/time string from web in the format of "yyyy/mm/dd’T’HH:MM:SS’Z’" and it is in UTC.
Now I have to identify the current time zone of device and then convert this time to my local time..
How do I do it?
(FYI, Currently, UTC time is 10:25 AM, in India current time is 3:55 PM)
Try using
TimeZone.getDefault()instead ofTimeZone.getTimeZone("GMT")From the docs:
EDIT: You can parse date using SimpleDateFormat (there is also the documentation on the format string there). In your case, you want to do (untested):
alternatively, use two separate instances of SimpleDateFormat, one for original and one for target time.