Loading

Tuesday, August 9, 2011

Get time zone where currently running, using TimeZone.getDefault()

The method TimeZone.getDefault() returns the user's preferred time zone.



example:



        TextView textTimeZone = (TextView)findViewById(R.id.timezone);



TimeZone timezone = TimeZone.getDefault();

String TimeZoneName = timezone.getDisplayName();

int TimeZoneOffset = timezone.getRawOffset()/(60 * 60 * 1000);



textTimeZone.setText("My Time Zone\n" +

TimeZoneName + " : " +String.valueOf(TimeZoneOffset));






Related Post:

- Get Installed Time Zone


SHARE TWEET

Thank you for reading this article Get time zone where currently running, using TimeZone.getDefault() With URL http://x-tutorials.blogspot.com/2011/08/get-time-zone-where-currently-running.html. Also a time to read the other articles.

0 comments:

Write your comment for this article Get time zone where currently running, using TimeZone.getDefault() above!