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

Tuesday, 9 August 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


Borneo08

About Borneo08

Author Description here.. Nulla sagittis convallis. Curabitur consequat. Quisque metus enim, venenatis fermentum, mollis in, porta et, nibh. Duis vulputate elit in elit. Mauris dictum libero id justo.

Subscribe to this Blog via Email :

More links

Related Posts Plugin for WordPress, Blogger...