本文整理汇总了Java中java.time.format.TextStyle.SHORT属性的典型用法代码示例。如果您正苦于以下问题:Java TextStyle.SHORT属性的具体用法?Java TextStyle.SHORT怎么用?Java TextStyle.SHORT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.time.format.TextStyle
的用法示例。
在下文中一共展示了TextStyle.SHORT属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: data_preferredZones
@DataProvider(name="preferredZones")
Object[][] data_preferredZones() {
return new Object[][] {
{"America/New_York", "Eastern Standard Time", none, Locale.ENGLISH, TextStyle.FULL},
// {"EST", "Eastern Standard Time", preferred, Locale.ENGLISH, TextStyle.FULL},
{"Europe/Paris", "Central European Time", none, Locale.ENGLISH, TextStyle.FULL},
{"CET", "Central European Time", preferred, Locale.ENGLISH, TextStyle.FULL},
{"Asia/Shanghai", "China Standard Time", none, Locale.ENGLISH, TextStyle.FULL},
{"Asia/Taipei", "China Standard Time", preferred, Locale.ENGLISH, TextStyle.FULL},
{"America/Chicago", "CST", none, Locale.ENGLISH, TextStyle.SHORT},
{"Asia/Taipei", "CST", preferred, Locale.ENGLISH, TextStyle.SHORT},
{"Australia/South", "ACST", preferred_s, Locale.ENGLISH, TextStyle.SHORT},
{"America/Chicago", "CDT", none, Locale.ENGLISH, TextStyle.SHORT},
{"Asia/Shanghai", "CDT", preferred_s, Locale.ENGLISH, TextStyle.SHORT},
};
}
示例2: provider_japaneseEra
@DataProvider(name="print_JapaneseChronology")
Object[][] provider_japaneseEra() {
return new Object[][] {
{ERA, TextStyle.FULL, 2, "Heisei"}, // Note: CLDR doesn't define "wide" Japanese era names.
{ERA, TextStyle.SHORT, 2, "Heisei"},
{ERA, TextStyle.NARROW, 2, "H"},
};
}
示例3: data_preferredZones
@DataProvider(name="preferredZones")
Object[][] data_preferredZones() {
return new Object[][] {
{"America/New_York", "Eastern Standard Time", none, Locale.ENGLISH, TextStyle.FULL},
// {"EST", "Eastern Standard Time", preferred, Locale.ENGLISH, TextStyle.FULL},
{"Europe/Paris", "Central European Time", none, Locale.ENGLISH, TextStyle.FULL},
// {"CET", "Central European Time", preferred, Locale.ENGLISH, TextStyle.FULL}, no three-letter ID in CLDR
{"Asia/Shanghai", "China Standard Time", none, Locale.ENGLISH, TextStyle.FULL},
{"Asia/Macau", "China Standard Time", preferred, Locale.ENGLISH, TextStyle.FULL},
{"Asia/Taipei", "Taipei Standard Time", preferred, Locale.ENGLISH, TextStyle.FULL},
{"America/Chicago", "CST", none, Locale.ENGLISH, TextStyle.SHORT},
{"Asia/Taipei", "CST", preferred, Locale.ENGLISH, TextStyle.SHORT},
{"Australia/South", "ACST", preferred_s, Locale.ENGLISH, TextStyle.SHORT},
{"America/Chicago", "CDT", none, Locale.ENGLISH, TextStyle.SHORT},
{"Asia/Shanghai", "CDT", preferred_s, Locale.ENGLISH, TextStyle.SHORT},
};
}
示例4: data_print_localized
@DataProvider(name="print_localized")
Object[][] data_print_localized() {
return new Object[][] {
{TextStyle.FULL, DT_2012_06_30_12_30_40, OFFSET_UTC, "GMT"},
{TextStyle.FULL, DT_2012_06_30_12_30_40, OFFSET_P0100, "GMT+01:00"},
{TextStyle.FULL, DT_2012_06_30_12_30_40, OFFSET_P0123, "GMT+01:23"},
{TextStyle.FULL, DT_2012_06_30_12_30_40, OFFSET_P0023, "GMT+00:23"},
{TextStyle.FULL, DT_2012_06_30_12_30_40, OFFSET_P012345, "GMT+01:23:45"},
{TextStyle.FULL, DT_2012_06_30_12_30_40, OFFSET_M000045, "GMT-00:00:45"},
{TextStyle.FULL, DT_2012_06_30_12_30_40, OFFSET_M0100, "GMT-01:00"},
{TextStyle.FULL, DT_2012_06_30_12_30_40, OFFSET_M0123, "GMT-01:23"},
{TextStyle.FULL, DT_2012_06_30_12_30_40, OFFSET_M0023, "GMT-00:23"},
{TextStyle.FULL, DT_2012_06_30_12_30_40, OFFSET_M012345, "GMT-01:23:45"},
{TextStyle.FULL, DT_2012_06_30_12_30_40, OFFSET_M000045, "GMT-00:00:45"},
{TextStyle.SHORT, DT_2012_06_30_12_30_40, OFFSET_UTC, "GMT"},
{TextStyle.SHORT, DT_2012_06_30_12_30_40, OFFSET_P0100, "GMT+1"},
{TextStyle.SHORT, DT_2012_06_30_12_30_40, OFFSET_P0123, "GMT+1:23"},
{TextStyle.SHORT, DT_2012_06_30_12_30_40, OFFSET_P0023, "GMT+0:23"},
{TextStyle.SHORT, DT_2012_06_30_12_30_40, OFFSET_P012345, "GMT+1:23:45"},
{TextStyle.SHORT, DT_2012_06_30_12_30_40, OFFSET_M000045, "GMT-0:00:45"},
{TextStyle.SHORT, DT_2012_06_30_12_30_40, OFFSET_M0100, "GMT-1"},
{TextStyle.SHORT, DT_2012_06_30_12_30_40, OFFSET_M0123, "GMT-1:23"},
{TextStyle.SHORT, DT_2012_06_30_12_30_40, OFFSET_M0023, "GMT-0:23"},
{TextStyle.SHORT, DT_2012_06_30_12_30_40, OFFSET_M012345, "GMT-1:23:45"},
{TextStyle.SHORT, DT_2012_06_30_12_30_40, OFFSET_M000045, "GMT-0:00:45"},
};
}
示例5: test_print_localized
@Test(dataProvider="print_localized")
public void test_print_localized(TextStyle style, LocalDateTime ldt, ZoneOffset offset, String expected) {
OffsetDateTime odt = OffsetDateTime.of(ldt, offset);
ZonedDateTime zdt = ldt.atZone(offset);
DateTimeFormatter f = new DateTimeFormatterBuilder().appendLocalizedOffset(style)
.toFormatter();
assertEquals(f.format(odt), expected);
assertEquals(f.format(zdt), expected);
assertEquals(f.parse(expected, ZoneOffset::from), offset);
if (style == TextStyle.FULL) {
f = new DateTimeFormatterBuilder().appendPattern("ZZZZ")
.toFormatter();
assertEquals(f.format(odt), expected);
assertEquals(f.format(zdt), expected);
assertEquals(f.parse(expected, ZoneOffset::from), offset);
f = new DateTimeFormatterBuilder().appendPattern("OOOO")
.toFormatter();
assertEquals(f.format(odt), expected);
assertEquals(f.format(zdt), expected);
assertEquals(f.parse(expected, ZoneOffset::from), offset);
}
if (style == TextStyle.SHORT) {
f = new DateTimeFormatterBuilder().appendPattern("O")
.toFormatter();
assertEquals(f.format(odt), expected);
assertEquals(f.format(zdt), expected);
assertEquals(f.parse(expected, ZoneOffset::from), offset);
}
}
示例6: provider_number
@DataProvider(name="parseNumber")
Object[][] provider_number() {
return new Object[][] {
{DAY_OF_MONTH, TextStyle.FULL, 1, "1"},
{DAY_OF_MONTH, TextStyle.FULL, 2, "2"},
{DAY_OF_MONTH, TextStyle.FULL, 30, "30"},
{DAY_OF_MONTH, TextStyle.FULL, 31, "31"},
{DAY_OF_MONTH, TextStyle.SHORT, 1, "1"},
{DAY_OF_MONTH, TextStyle.SHORT, 2, "2"},
{DAY_OF_MONTH, TextStyle.SHORT, 30, "30"},
{DAY_OF_MONTH, TextStyle.SHORT, 31, "31"},
};
}
示例7: data_text
@DataProvider(name="printText")
Object[][] data_text() {
return new Object[][] {
{DAY_OF_WEEK, TextStyle.FULL, 1, "Monday"},
{DAY_OF_WEEK, TextStyle.FULL, 2, "Tuesday"},
{DAY_OF_WEEK, TextStyle.FULL, 3, "Wednesday"},
{DAY_OF_WEEK, TextStyle.FULL, 4, "Thursday"},
{DAY_OF_WEEK, TextStyle.FULL, 5, "Friday"},
{DAY_OF_WEEK, TextStyle.FULL, 6, "Saturday"},
{DAY_OF_WEEK, TextStyle.FULL, 7, "Sunday"},
{DAY_OF_WEEK, TextStyle.SHORT, 1, "Mon"},
{DAY_OF_WEEK, TextStyle.SHORT, 2, "Tue"},
{DAY_OF_WEEK, TextStyle.SHORT, 3, "Wed"},
{DAY_OF_WEEK, TextStyle.SHORT, 4, "Thu"},
{DAY_OF_WEEK, TextStyle.SHORT, 5, "Fri"},
{DAY_OF_WEEK, TextStyle.SHORT, 6, "Sat"},
{DAY_OF_WEEK, TextStyle.SHORT, 7, "Sun"},
{DAY_OF_MONTH, TextStyle.FULL, 1, "1"},
{DAY_OF_MONTH, TextStyle.FULL, 2, "2"},
{DAY_OF_MONTH, TextStyle.FULL, 3, "3"},
{DAY_OF_MONTH, TextStyle.FULL, 28, "28"},
{DAY_OF_MONTH, TextStyle.FULL, 29, "29"},
{DAY_OF_MONTH, TextStyle.FULL, 30, "30"},
{DAY_OF_MONTH, TextStyle.FULL, 31, "31"},
{DAY_OF_MONTH, TextStyle.SHORT, 1, "1"},
{DAY_OF_MONTH, TextStyle.SHORT, 2, "2"},
{DAY_OF_MONTH, TextStyle.SHORT, 3, "3"},
{DAY_OF_MONTH, TextStyle.SHORT, 28, "28"},
{DAY_OF_MONTH, TextStyle.SHORT, 29, "29"},
{DAY_OF_MONTH, TextStyle.SHORT, 30, "30"},
{DAY_OF_MONTH, TextStyle.SHORT, 31, "31"},
{MONTH_OF_YEAR, TextStyle.FULL, 1, "January"},
{MONTH_OF_YEAR, TextStyle.FULL, 12, "December"},
{MONTH_OF_YEAR, TextStyle.SHORT, 1, "Jan"},
{MONTH_OF_YEAR, TextStyle.SHORT, 12, "Dec"},
};
}
示例8: provider_text
@DataProvider(name="parseText")
Object[][] provider_text() {
return new Object[][] {
{DAY_OF_WEEK, TextStyle.FULL, 1, "Monday"},
{DAY_OF_WEEK, TextStyle.FULL, 2, "Tuesday"},
{DAY_OF_WEEK, TextStyle.FULL, 3, "Wednesday"},
{DAY_OF_WEEK, TextStyle.FULL, 4, "Thursday"},
{DAY_OF_WEEK, TextStyle.FULL, 5, "Friday"},
{DAY_OF_WEEK, TextStyle.FULL, 6, "Saturday"},
{DAY_OF_WEEK, TextStyle.FULL, 7, "Sunday"},
{DAY_OF_WEEK, TextStyle.SHORT, 1, "Mon"},
{DAY_OF_WEEK, TextStyle.SHORT, 2, "Tue"},
{DAY_OF_WEEK, TextStyle.SHORT, 3, "Wed"},
{DAY_OF_WEEK, TextStyle.SHORT, 4, "Thu"},
{DAY_OF_WEEK, TextStyle.SHORT, 5, "Fri"},
{DAY_OF_WEEK, TextStyle.SHORT, 6, "Sat"},
{DAY_OF_WEEK, TextStyle.SHORT, 7, "Sun"},
{MONTH_OF_YEAR, TextStyle.FULL, 1, "January"},
{MONTH_OF_YEAR, TextStyle.FULL, 12, "December"},
{MONTH_OF_YEAR, TextStyle.SHORT, 1, "Jan"},
{MONTH_OF_YEAR, TextStyle.SHORT, 12, "Dec"},
{QUARTER_OF_YEAR, TextStyle.FULL, 1, "1st quarter"},
{QUARTER_OF_YEAR, TextStyle.FULL, 2, "2nd quarter"},
{QUARTER_OF_YEAR, TextStyle.FULL, 3, "3rd quarter"},
{QUARTER_OF_YEAR, TextStyle.FULL, 4, "4th quarter"},
{QUARTER_OF_YEAR, TextStyle.SHORT, 1, "Q1"},
{QUARTER_OF_YEAR, TextStyle.SHORT, 2, "Q2"},
{QUARTER_OF_YEAR, TextStyle.SHORT, 3, "Q3"},
{QUARTER_OF_YEAR, TextStyle.SHORT, 4, "Q4"},
{QUARTER_OF_YEAR, TextStyle.NARROW, 1, "1"},
{QUARTER_OF_YEAR, TextStyle.NARROW, 2, "2"},
{QUARTER_OF_YEAR, TextStyle.NARROW, 3, "3"},
{QUARTER_OF_YEAR, TextStyle.NARROW, 4, "4"},
};
}
示例9: data_text
@DataProvider(name = "Text")
Object[][] data_text() {
return new Object[][] {
{DAY_OF_WEEK, 1, TextStyle.SHORT, ptBR, "seg"},
{DAY_OF_WEEK, 2, TextStyle.SHORT, ptBR, "ter"},
{DAY_OF_WEEK, 3, TextStyle.SHORT, ptBR, "qua"},
{DAY_OF_WEEK, 4, TextStyle.SHORT, ptBR, "qui"},
{DAY_OF_WEEK, 5, TextStyle.SHORT, ptBR, "sex"},
{DAY_OF_WEEK, 6, TextStyle.SHORT, ptBR, "s\u00E1b"},
{DAY_OF_WEEK, 7, TextStyle.SHORT, ptBR, "dom"},
{DAY_OF_WEEK, 1, TextStyle.FULL, ptBR, "segunda-feira"},
{DAY_OF_WEEK, 2, TextStyle.FULL, ptBR, "ter\u00E7a-feira"},
{DAY_OF_WEEK, 3, TextStyle.FULL, ptBR, "quarta-feira"},
{DAY_OF_WEEK, 4, TextStyle.FULL, ptBR, "quinta-feira"},
{DAY_OF_WEEK, 5, TextStyle.FULL, ptBR, "sexta-feira"},
{DAY_OF_WEEK, 6, TextStyle.FULL, ptBR, "s\u00E1bado"},
{DAY_OF_WEEK, 7, TextStyle.FULL, ptBR, "domingo"},
{MONTH_OF_YEAR, 1, TextStyle.SHORT, ptBR, "jan"},
{MONTH_OF_YEAR, 2, TextStyle.SHORT, ptBR, "fev"},
{MONTH_OF_YEAR, 3, TextStyle.SHORT, ptBR, "mar"},
{MONTH_OF_YEAR, 4, TextStyle.SHORT, ptBR, "abr"},
{MONTH_OF_YEAR, 5, TextStyle.SHORT, ptBR, "mai"},
{MONTH_OF_YEAR, 6, TextStyle.SHORT, ptBR, "jun"},
{MONTH_OF_YEAR, 7, TextStyle.SHORT, ptBR, "jul"},
{MONTH_OF_YEAR, 8, TextStyle.SHORT, ptBR, "ago"},
{MONTH_OF_YEAR, 9, TextStyle.SHORT, ptBR, "set"},
{MONTH_OF_YEAR, 10, TextStyle.SHORT, ptBR, "out"},
{MONTH_OF_YEAR, 11, TextStyle.SHORT, ptBR, "nov"},
{MONTH_OF_YEAR, 12, TextStyle.SHORT, ptBR, "dez"},
{MONTH_OF_YEAR, 1, TextStyle.FULL, ptBR, "janeiro"},
{MONTH_OF_YEAR, 2, TextStyle.FULL, ptBR, "fevereiro"},
{MONTH_OF_YEAR, 3, TextStyle.FULL, ptBR, "mar\u00E7o"},
{MONTH_OF_YEAR, 4, TextStyle.FULL, ptBR, "abril"},
{MONTH_OF_YEAR, 5, TextStyle.FULL, ptBR, "maio"},
{MONTH_OF_YEAR, 6, TextStyle.FULL, ptBR, "junho"},
{MONTH_OF_YEAR, 7, TextStyle.FULL, ptBR, "julho"},
{MONTH_OF_YEAR, 8, TextStyle.FULL, ptBR, "agosto"},
{MONTH_OF_YEAR, 9, TextStyle.FULL, ptBR, "setembro"},
{MONTH_OF_YEAR, 10, TextStyle.FULL, ptBR, "outubro"},
{MONTH_OF_YEAR, 11, TextStyle.FULL, ptBR, "novembro"},
{MONTH_OF_YEAR, 12, TextStyle.FULL, ptBR, "dezembro"},
};
}
示例10: data_text
@DataProvider(name = "Text")
Object[][] data_text() {
return new Object[][] {
{DAY_OF_WEEK, 1, TextStyle.SHORT, enUS, "Mon"},
{DAY_OF_WEEK, 2, TextStyle.SHORT, enUS, "Tue"},
{DAY_OF_WEEK, 3, TextStyle.SHORT, enUS, "Wed"},
{DAY_OF_WEEK, 4, TextStyle.SHORT, enUS, "Thu"},
{DAY_OF_WEEK, 5, TextStyle.SHORT, enUS, "Fri"},
{DAY_OF_WEEK, 6, TextStyle.SHORT, enUS, "Sat"},
{DAY_OF_WEEK, 7, TextStyle.SHORT, enUS, "Sun"},
{DAY_OF_WEEK, 1, TextStyle.FULL, enUS, "Monday"},
{DAY_OF_WEEK, 2, TextStyle.FULL, enUS, "Tuesday"},
{DAY_OF_WEEK, 3, TextStyle.FULL, enUS, "Wednesday"},
{DAY_OF_WEEK, 4, TextStyle.FULL, enUS, "Thursday"},
{DAY_OF_WEEK, 5, TextStyle.FULL, enUS, "Friday"},
{DAY_OF_WEEK, 6, TextStyle.FULL, enUS, "Saturday"},
{DAY_OF_WEEK, 7, TextStyle.FULL, enUS, "Sunday"},
{MONTH_OF_YEAR, 1, TextStyle.SHORT, enUS, "Jan"},
{MONTH_OF_YEAR, 2, TextStyle.SHORT, enUS, "Feb"},
{MONTH_OF_YEAR, 3, TextStyle.SHORT, enUS, "Mar"},
{MONTH_OF_YEAR, 4, TextStyle.SHORT, enUS, "Apr"},
{MONTH_OF_YEAR, 5, TextStyle.SHORT, enUS, "May"},
{MONTH_OF_YEAR, 6, TextStyle.SHORT, enUS, "Jun"},
{MONTH_OF_YEAR, 7, TextStyle.SHORT, enUS, "Jul"},
{MONTH_OF_YEAR, 8, TextStyle.SHORT, enUS, "Aug"},
{MONTH_OF_YEAR, 9, TextStyle.SHORT, enUS, "Sep"},
{MONTH_OF_YEAR, 10, TextStyle.SHORT, enUS, "Oct"},
{MONTH_OF_YEAR, 11, TextStyle.SHORT, enUS, "Nov"},
{MONTH_OF_YEAR, 12, TextStyle.SHORT, enUS, "Dec"},
{MONTH_OF_YEAR, 1, TextStyle.FULL, enUS, "January"},
{MONTH_OF_YEAR, 2, TextStyle.FULL, enUS, "February"},
{MONTH_OF_YEAR, 3, TextStyle.FULL, enUS, "March"},
{MONTH_OF_YEAR, 4, TextStyle.FULL, enUS, "April"},
{MONTH_OF_YEAR, 5, TextStyle.FULL, enUS, "May"},
{MONTH_OF_YEAR, 6, TextStyle.FULL, enUS, "June"},
{MONTH_OF_YEAR, 7, TextStyle.FULL, enUS, "July"},
{MONTH_OF_YEAR, 8, TextStyle.FULL, enUS, "August"},
{MONTH_OF_YEAR, 9, TextStyle.FULL, enUS, "September"},
{MONTH_OF_YEAR, 10, TextStyle.FULL, enUS, "October"},
{MONTH_OF_YEAR, 11, TextStyle.FULL, enUS, "November"},
{MONTH_OF_YEAR, 12, TextStyle.FULL, enUS, "December"},
{AMPM_OF_DAY, 0, TextStyle.SHORT, enUS, "AM"},
{AMPM_OF_DAY, 1, TextStyle.SHORT, enUS, "PM"},
};
}