本文整理匯總了Java中libcore.icu.TimeZoneNames類的典型用法代碼示例。如果您正苦於以下問題:Java TimeZoneNames類的具體用法?Java TimeZoneNames怎麽用?Java TimeZoneNames使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TimeZoneNames類屬於libcore.icu包,在下文中一共展示了TimeZoneNames類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: internalZoneStrings
import libcore.icu.TimeZoneNames; //導入依賴的package包/類
/**
* Gets zone strings, initializing them if necessary. Does not create
* a defensive copy, so make sure you do so before exposing the returned
* arrays to clients.
*/
synchronized String[][] internalZoneStrings() {
if (zoneStrings == null) {
zoneStrings = TimeZoneNames.getZoneStrings(locale);
}
return zoneStrings;
}
示例2: getTimeZoneDisplayName
import libcore.icu.TimeZoneNames; //導入依賴的package包/類
/**
* Returns the display name of the timezone specified. Returns null if no name was found in the
* zone strings.
*
* @param daylight whether to return the daylight savings or the standard name
* @param style one of the {@link TimeZone} styles such as {@link TimeZone#SHORT}
*
* @hide used internally
*/
String getTimeZoneDisplayName(TimeZone tz, boolean daylight, int style) {
if (style != TimeZone.SHORT && style != TimeZone.LONG) {
throw new IllegalArgumentException("Bad style: " + style);
}
// If custom zone strings have been set with setZoneStrings() we use those. Otherwise we
// use the ones from LocaleData.
String[][] zoneStrings = internalZoneStrings();
return TimeZoneNames.getDisplayName(zoneStrings, tz.getID(), daylight, style);
}