It's up to you!
You can use Locale.getDefault()
or a Calendar
instance.
Locale.getDefault()
is not a TimeZone, but specify the language in device
Calendar calendar = Calendar.getInstance();
Locale.getDefault()
.
Below I present some examples:
Printing Log.d(LOG_TAG, String.valueOf(TimeZone.getDefault()));
shows:
D/MyActivity: libcore.util.ZoneInfo[id="Brazil/East",mRawOffset=-10800000,mEarliestRawOffset=-10800000,mUseDst=true,mDstSavings=3600000,transitions=128]
.
Printing Log.d(LOG_TAG, TimeZone.getDefault().getID());
shows:
D/MyActivity: Brazil/East
.
Printing Log.d(LOG_TAG, String.valueOf(Locale.getDefault()));
shows:
D/MyActivity: fr_FR
.
Printing Log.d(LOG_TAG, String.valueOf(calendar.getTimeZone()));
shows:
D/MyActivity: libcore.util.ZoneInfo[id="Brazil/East",mRawOffset=-10800000,mEarliestRawOffset=-10800000,mUseDst=true,mDstSavings=3600000,transitions=128]
.
Printing Log.d(LOG_TAG, calendar.getTimeZone().getDisplayName());
shows:
D/MyActivity: heure normale de Brasilia
.
Printing timezone displayName without locale and Timezone SHORT:
Log.d(LOG_TAG, calendar.getTimeZone().getDisplayName(false, TimeZone.SHORT));
shows output:
D/MyActivity: GMT-03:00
.
Printing timezone displayName without locale and Timezone LONG
Log.d(LOG_TAG, calendar.getTimeZone().getDisplayName(false, TimeZone.LONG));
shows output:
D/MyActivity: heure normale de Brasilia
.
Check the Javadoc for the method you're using:
http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Calendar.html#getInstance(java.util.Locale)
Gets a calendar using the default time zone and specified locale.
Check this comments to be more clear to you: