Home
last modified time | relevance | path

Searched refs:DateTimeFormatter (Results 1 – 25 of 76) sorted by relevance

1234

/libcore/ojluni/src/test/java/time/test/java/time/format/
DTestDateTimeParsing.java80 import java.time.format.DateTimeFormatter;
99 private static final DateTimeFormatter LOCALFIELDS = new DateTimeFormatterBuilder()
101 private static final DateTimeFormatter LOCALFIELDS_ZONEID = new DateTimeFormatterBuilder()
103 private static final DateTimeFormatter LOCALFIELDS_OFFSETID = new DateTimeFormatterBuilder()
105 private static final DateTimeFormatter LOCALFIELDS_WITH_PARIS = LOCALFIELDS.withZone(PARIS);
106 … private static final DateTimeFormatter LOCALFIELDS_WITH_0230 = LOCALFIELDS.withZone(OFFSET_0230);
107 private static final DateTimeFormatter INSTANT = new DateTimeFormatterBuilder()
109 private static final DateTimeFormatter INSTANT_WITH_PARIS = INSTANT.withZone(PARIS);
110 private static final DateTimeFormatter INSTANT_WITH_0230 = INSTANT.withZone(OFFSET_0230);
111 private static final DateTimeFormatter INSTANT_WITH_NEW_YORK = INSTANT.withZone(NEW_YORK);
[all …]
DTestDateTimeFormatter.java84 import java.time.format.DateTimeFormatter;
106 DateTimeFormatter base = in test_withLocale_same()
111 DateTimeFormatter test = base.withLocale(Locale.ENGLISH); in test_withLocale_same()
150 DateTimeFormatter f = DateTimeFormatter.ofPattern("yyyy-mm-dd"); in assertGoodErrorDate()
165 DateTimeFormatter f = DateTimeFormatter.ofPattern("HH:MM:ss"); in assertGoodErrorTime()
181 DateTimeFormatter f = DateTimeFormatter.ofPattern("HH:mm:ss"); in test_parsed_toString_resolvedTime()
189 DateTimeFormatter f = DateTimeFormatter.ofPattern("yyyy-MM-dd"); in test_parsed_toString_resolvedDate()
197 DateTimeFormatter f = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); in test_parsed_toString_resolvedDateTime()
216 DateTimeFormatter fmt = DateTimeFormatter.ofPattern(pattern); in test_throws_message()
237 DateTimeFormatter fmt = new DateTimeFormatterBuilder().appendZoneId().toFormatter() in test_throws_message_chrono()
[all …]
DAbstractTestPrinterParser.java67 import java.time.format.DateTimeFormatter;
116 protected DateTimeFormatter getFormatter() { in getFormatter()
120 protected DateTimeFormatter getFormatter(char c) { in getFormatter()
124 protected DateTimeFormatter getFormatter(String s) { in getFormatter()
128 protected DateTimeFormatter getFormatter(TemporalField field) { in getFormatter()
132 protected DateTimeFormatter getFormatter(TemporalField field, TextStyle style) { in getFormatter()
136 …protected DateTimeFormatter getFormatter(TemporalField field, int minWidth, int maxWidth, SignStyl… in getFormatter()
140 protected DateTimeFormatter getFormatter(String pattern, String noOffsetText) { in getFormatter()
144 protected DateTimeFormatter getPatternFormatter(String pattern) { in getPatternFormatter()
DTestDateTimeFormatterBuilder.java62 import static java.time.format.DateTimeFormatter.ISO_LOCAL_TIME;
82 import java.time.format.DateTimeFormatter;
119 DateTimeFormatter f = builder.toFormatter(); in test_toFormatter_empty()
127 DateTimeFormatter f = builder.toFormatter(); in test_parseCaseSensitive()
134 DateTimeFormatter f = builder.toFormatter(); in test_parseCaseInsensitive()
142 DateTimeFormatter f = builder.toFormatter(); in test_parseStrict()
149 DateTimeFormatter f = builder.toFormatter(); in test_parseLenient()
157 DateTimeFormatter f = builder.toFormatter(); in test_appendValue_1arg()
170 DateTimeFormatter f = builder.toFormatter(); in test_appendValue_2arg()
193 DateTimeFormatter f = builder.toFormatter(); in test_appendValue_3arg()
[all …]
DTestNonIsoFormatter.java49 import java.time.format.DateTimeFormatter;
159 DateTimeFormatter dtf = DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL) in test_formatLocalizedDate()
169 DateTimeFormatter dtf = DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL) in test_parseLocalizedText()
179 DateTimeFormatter dtf = DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL) in test_parseInvalidText()
188 DateTimeFormatter dtf = new DateTimeFormatterBuilder().appendChronologyText(TextStyle.SHORT) in test_chronoNames()
200 DateTimeFormatter dtf = new DateTimeFormatterBuilder() in test_lenientEraYear()
204 DateTimeFormatter dtfLenient = dtf.withResolverStyle(ResolverStyle.LENIENT); in test_lenientEraYear()
DTestReducedPrinter.java69 import java.time.format.DateTimeFormatter;
83 private DateTimeFormatter getFormatter0(TemporalField field, int width, int baseValue) { in getFormatter0()
87 …private DateTimeFormatter getFormatter0(TemporalField field, int minWidth, int maxWidth, int baseV… in getFormatter0()
91 …private DateTimeFormatter getFormatterBaseDate(TemporalField field, int minWidth, int maxWidth, in… in getFormatterBaseDate()
215 DateTimeFormatter f = getFormatterBaseDate(YEAR, 2, 2, 2021); in test_minguoChrono_fixedWidth()
232 DateTimeFormatter f = getFormatterBaseDate(YEAR, 2, 4, 2021); in test_minguoChrono_extendedWidth()
272 DateTimeFormatter dtf = builder.toFormatter(); in test_printAdjacent()
DTestTextParserWithLocale.java76 import java.time.format.DateTimeFormatter;
117 DateTimeFormatter formatter = getPatternFormatter(pattern).withLocale(locale); in test_parseDayOfWeekText()
152 DateTimeFormatter formatter = getFormatter(field, style).withLocale(locale); in test_parseStandaloneText()
183 DateTimeFormatter formatter = getFormatter(field).withLocale(locale); in test_parseLenientText()
199 private static final DateTimeFormatter fmt_chrono =
221 DateTimeFormatter fmt = DateTimeFormatter.ofPattern("[GGG ]yyy-MM-dd") in test_chronoLocalDate()
DTestUnicodeExtension.java47 import java.time.format.DateTimeFormatter;
855 DateTimeFormatter dtf = in test_localizedBy()
856 DateTimeFormatter.ofLocalizedDateTime(FormatStyle.FULL, FormatStyle.FULL) in test_localizedBy()
878 DateTimeFormatter dtf = in test_withLocale()
879 DateTimeFormatter.ofLocalizedDateTime(FormatStyle.FULL, FormatStyle.FULL) in test_withLocale()
906 DateTimeFormatter dtf = in test_ofPattern()
907 DateTimeFormatter.ofPattern(PATTERN, locale); in test_ofPattern()
920 DateTimeFormatter dtf = in test_toFormatter()
933 DateTimeFormatter dtf = in test_shortTZID()
934 DateTimeFormatter.ofLocalizedDateTime(FormatStyle.FULL, FormatStyle.FULL) in test_shortTZID()
/libcore/ojluni/src/test/java/time/tck/java/time/format/
DTCKDateTimeFormatter.java94 import java.time.format.DateTimeFormatter;
122 private static final DateTimeFormatter BASIC_FORMATTER = DateTimeFormatter.ofPattern("'ONE'd");
123 …private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("'ONE'yyyy MM …
125 private DateTimeFormatter fmt;
137DateTimeFormatter base = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD); in test_withLocale()
138 DateTimeFormatter test = base.withLocale(Locale.GERMAN); in test_withLocale()
144DateTimeFormatter base = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD); in test_withLocale_null()
151 DateTimeFormatter test = fmt; in test_withChronology()
162 DateTimeFormatter test = fmt; in test_withZone()
175 DateTimeFormatter base = new DateTimeFormatterBuilder() in test_resolverFields_selectOneDateResolveYMD()
[all …]
DTCKDateTimeFormatters.java89 import java.time.format.DateTimeFormatter;
121 DateTimeFormatter.ISO_DATE.format((TemporalAccessor) null); in test_format_nullTemporalAccessor()
129 DateTimeFormatter test = DateTimeFormatter.ofPattern("d MMM yyyy"); in test_pattern_String()
138 DateTimeFormatter.ofPattern("p"); in test_pattern_String_invalid()
143 DateTimeFormatter.ofPattern(null); in test_pattern_String_null()
151 DateTimeFormatter test = DateTimeFormatter.ofPattern("d MMM yyyy", Locale.UK); in test_pattern_StringLocale()
158 DateTimeFormatter.ofPattern("p", Locale.UK); in test_pattern_StringLocale_invalid()
163 DateTimeFormatter.ofPattern(null, Locale.UK); in test_pattern_StringLocale_nullPattern()
168 DateTimeFormatter.ofPattern("yyyy", null); in test_pattern_StringLocale_nullLocale()
176 …assertEquals(DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL).getChronology(), IsoChronology.IN… in test_ofLocalizedDate_basics()
[all …]
DTCKInstantPrinterParser.java70 import java.time.format.DateTimeFormatter;
119 DateTimeFormatter f = new DateTimeFormatterBuilder().appendInstant().toFormatter(); in test_print_grouped()
197DateTimeFormatter f = new DateTimeFormatterBuilder().appendInstant(fractionalDigits).toFormatter(); in test_print_digits()
242 DateTimeFormatter f = new DateTimeFormatterBuilder().appendInstant(-1).toFormatter(); in test_parse_digitsMinusOne()
244 assertEquals(f.parse(input).query(DateTimeFormatter.parsedExcessDays()), Period.ZERO); in test_parse_digitsMinusOne()
245 assertEquals(f.parse(input).query(DateTimeFormatter.parsedLeapSecond()), Boolean.FALSE); in test_parse_digitsMinusOne()
269 DateTimeFormatter f = new DateTimeFormatterBuilder().appendInstant(9).toFormatter(); in test_parse_digitsNine()
272 assertEquals(f.parse(input).query(DateTimeFormatter.parsedExcessDays()), Period.ZERO); in test_parse_digitsNine()
273 assertEquals(f.parse(input).query(DateTimeFormatter.parsedLeapSecond()), Boolean.FALSE); in test_parse_digitsNine()
286 DateTimeFormatter f = new DateTimeFormatterBuilder().appendInstant(-1).toFormatter(); in test_invalid_Instant()
[all …]
DTCKDateTimeFormatterBuilder.java62 import static java.time.format.DateTimeFormatter.BASIC_ISO_DATE;
81 import java.time.format.DateTimeFormatter;
112 DateTimeFormatter f = builder.toFormatter(); in test_toFormatter_empty()
119 DateTimeFormatter f = builder in test_parseDefaulting_entireDate()
128 DateTimeFormatter f = builder in test_parseDefaulting_yearOptionalMonthOptionalDay()
538 DateTimeFormatter f = builder.toFormatter(); in test_appendOffset_format()
546 DateTimeFormatter f = builder.toFormatter(); in test_appendOffset_parse()
597 DateTimeFormatter df = DateTimeFormatter.ofPattern(pattern, Locale.US); in test_appendZoneText_formatGenericTimeZonePatterns()
617DateTimeFormatter df = new DateTimeFormatterBuilder().appendPattern(pattern).toFormatter(Locale.US… in test_appendZoneText_parseGenericTimeZonePatterns()
644DateTimeFormatter df = new DateTimeFormatterBuilder().appendPattern(pattern).toFormatter(Locale.US… in test_appendZoneText_parseNonGenricTimeZonePatterns_1()
[all …]
DTCKDateTimeParseResolver.java115 import java.time.format.DateTimeFormatter;
157 DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field1).toFormatter(); in test_resolveOneNoChange()
194 DateTimeFormatter f = new DateTimeFormatterBuilder() in test_resolveTwoNoChange()
225 DateTimeFormatter f = new DateTimeFormatterBuilder() in test_resolveThreeNoChange()
262 DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field1).toFormatter(); in test_resolveOneToField()
288 DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field1).toFormatter(); in test_resolveOneToDate()
313 DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field1).toFormatter(); in test_resolveOneToTime()
342 DateTimeFormatter f = new DateTimeFormatterBuilder() in test_resolveTwoToField()
390 DateTimeFormatter f = new DateTimeFormatterBuilder() in test_resolveTwoToDate()
477 DateTimeFormatter f = new DateTimeFormatterBuilder() in test_resolveTwoToTime()
[all …]
DTCKLocalizedOffsetIdPrinterParser.java27 import java.time.format.DateTimeFormatter;
39 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.S O") in test_localized_offset_parse()
DTCKLocalizedFieldParser.java67 import java.time.format.DateTimeFormatter;
128 DateTimeFormatter dtf = b.toFormatter(locale); in test_parse_textField()
160 DateTimeFormatter dtf = b.toFormatter(locale); in test_parse_textLocalDate()
197 DateTimeFormatter dtf = b.toFormatter(locale); in test_parse_WeekBasedYear()
225 DateTimeFormatter df = new DateTimeFormatterBuilder() in test_adjacentValuePatterns1()
248 DateTimeFormatter df = new DateTimeFormatterBuilder() in test_adjacentValuePatterns2()
261 DateTimeFormatter df = new DateTimeFormatterBuilder() in test_adjacentValuePatterns3()
284 DateTimeFormatter.ofPattern(pattern).parse(value); in test_invalidPatterns()
DTCKDTFParsedInstant.java32 import java.time.format.DateTimeFormatter;
53 private DateTimeFormatter dtFormatter;
60 dtFormatter = DateTimeFormatter.ISO_ZONED_DATE_TIME; in setUp()
75 dtFormatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME; in testWithoutZoneWithoutOffset()
173 dtFormatter = DateTimeFormatter.ISO_ZONED_DATE_TIME; in testWithZoneWithOffset()
198 … dtFormatter = DateTimeFormatter.ofPattern("d MMM HH:mm:ss uuuu VV").withLocale(Locale.ENGLISH); in testWithZoneWithoutOffset()
217 dtFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME; in testWithOffsetWithoutZone()
DTCKDateTimeTextPrinting.java69 import java.time.format.DateTimeFormatter;
140 DateTimeFormatter f = builder.appendText(field, style).toFormatter(Locale.ENGLISH); in test_appendText2arg_format()
150 DateTimeFormatter f = builder.appendText(field).toFormatter(Locale.ENGLISH); in test_appendText1arg_format()
175 DateTimeFormatter f = builder.toFormatter(); in test_appendTextMap()
189 DateTimeFormatter f = builder.toFormatter(); in test_appendTextMap_DOM()
201 DateTimeFormatter f = builder.toFormatter(); in test_appendTextMapIncomplete()
DTCKLocalizedFieldPrinter.java65 import java.time.format.DateTimeFormatter;
124 DateTimeFormatter dtf = DateTimeFormatter.ofPattern(pattern, locale); in test_print_WeekBasedYear()
DTCKResolverStyle.java63 import java.time.format.DateTimeFormatter;
121DateTimeFormatter optionalFormatter = new DateTimeFormatterBuilder().appendLiteral(" ").appendText… in test_resolverStyle()
123 DateTimeFormatter formatter = builder.appendOptional(optionalFormatter).toFormatter(); in test_resolverStyle()
/libcore/luni/src/test/java/libcore/java/time/format/
DDateTimeFormatterTest.java26 import java.time.format.DateTimeFormatter;
56 DateTimeFormatter[] formatters = new DateTimeFormatter[] { in test_getDecimalStyle()
57 DateTimeFormatter.ISO_DATE, in test_getDecimalStyle()
58 DateTimeFormatter.RFC_1123_DATE_TIME, in test_getDecimalStyle()
69 for (DateTimeFormatter formatter : formatters) { in test_getDecimalStyle()
73 DateTimeFormatter arStyleFormatter = formatter.withDecimalStyle(arDecimalStyle); in test_getDecimalStyle()
100 return DateTimeFormatter.ofPattern(pattern, l).format(datetime); in formatWithPattern()
109 DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT) in test_format_locale_my_MM()
121 DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT) in test_format_locale_de_AT()
133 DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT) in test_format_locale_tok()
DDateTimeFormatterBuilderTest.java26 import java.time.format.DateTimeFormatter;
46 DateTimeFormatter formatter = new DateTimeFormatterBuilder() in test_append_DateTimeFormatter()
47 .appendLiteral('<').append(DateTimeFormatter.ISO_LOCAL_DATE).appendLiteral('>') in test_append_DateTimeFormatter()
54 DateTimeFormatter formatter = in test_appendZoneRegionId_format()
65 DateTimeFormatter formatter = in test_appendZoneRegionId_format_offset()
77 DateTimeFormatter formatter = new DateTimeFormatterBuilder().appendZoneRegionId() in test_appendZoneRegionId_parse()
97 DateTimeFormatter formatter = new DateTimeFormatterBuilder() in test_appendGenericZoneText()
/libcore/ojluni/src/main/java/java/time/format/
DDateTimeFormatter.java514 public final class DateTimeFormatter { class
566 public static DateTimeFormatter ofPattern(String pattern) { in ofPattern()
590 public static DateTimeFormatter ofPattern(String pattern, Locale locale) { in ofPattern()
617 public static DateTimeFormatter ofLocalizedDate(FormatStyle dateStyle) { in ofLocalizedDate()
648 public static DateTimeFormatter ofLocalizedTime(FormatStyle timeStyle) { in ofLocalizedTime()
679 public static DateTimeFormatter ofLocalizedDateTime(FormatStyle dateTimeStyle) { in ofLocalizedDateTime()
711 …public static DateTimeFormatter ofLocalizedDateTime(FormatStyle dateStyle, FormatStyle timeStyle) { in ofLocalizedDateTime()
742 public static final DateTimeFormatter ISO_LOCAL_DATE;
772 public static final DateTimeFormatter ISO_OFFSET_DATE;
804 public static final DateTimeFormatter ISO_DATE;
[all …]
/libcore/luni/src/test/java/libcore/highmemorytest/java/time/format/
DDateTimeFormatterTest.java26 import java.time.format.DateTimeFormatter;
62 DateTimeFormatter.ofLocalizedTime(formatStyle) in test_format_allLocales()
67 DateTimeFormatter.ofLocalizedDate(formatStyle) in test_format_allLocales()
72 DateTimeFormatter.ofLocalizedDateTime(formatStyle) in test_format_allLocales()
91 DateTimeFormatter.ofLocalizedTime(formatStyle) in test_format_allLocales_allChronologies()
97 DateTimeFormatter.ofLocalizedDate(formatStyle) in test_format_allLocales_allChronologies()
103 DateTimeFormatter.ofLocalizedDateTime(formatStyle) in test_format_allLocales_allChronologies()
/libcore/ojluni/src/test/java/time/tck/java/time/temporal/
DTCKIsoFields.java75 import java.time.format.DateTimeFormatter;
156 DateTimeFormatter f = new DateTimeFormatterBuilder() in test_parse_quarters()
167 DateTimeFormatter f = new DateTimeFormatterBuilder() in test_parse_quarters_SMART()
178 DateTimeFormatter f = new DateTimeFormatterBuilder() in test_parse_quarters_LENIENT()
213 DateTimeFormatter f = new DateTimeFormatterBuilder() in test_parse_parseLenientQuarter_STRICT()
223 DateTimeFormatter f = new DateTimeFormatterBuilder() in test_parse_parseLenientQuarter_SMART()
243 DateTimeFormatter f = new DateTimeFormatterBuilder() in test_parse_parseLenientQuarter_LENIENT()
355 DateTimeFormatter f = new DateTimeFormatterBuilder() in test_parse_weeks_STRICT()
366 DateTimeFormatter f = new DateTimeFormatterBuilder() in test_parse_weeks_SMART()
377 DateTimeFormatter f = new DateTimeFormatterBuilder() in test_parse_weeks_LENIENT()
[all …]
DTCKJulianFields.java66 import java.time.format.DateTimeFormatter;
144 DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field) in test_samples_parse_STRICT()
152 DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field) in test_samples_parse_SMART()
160 DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field) in test_samples_parse_LENIENT()

1234