@Test public void testParseFromZendeskTicketType() { DefaultPacificDateTimeParser parser = new DefaultPacificDateTimeParser(ZendeskTicket.TIME_PATTERN); ZonedDateTime pst = parser.parse("Apr 10, 2017 7:56:04 PM"); assertEquals(2017, pst.getYear()); assertEquals(Month.APRIL, pst.getMonth()); assertEquals(10, pst.getDayOfMonth()); assertEquals(19, pst.getHour()); assertEquals(ZoneId.of("America/Los_Angeles"), pst.getZone()); }
@Override public ZonedDateTime parse(final String... columns) { checkNotNull(columns, "No columns to parse from"); checkArgument(columns.length == 1, String.format("Expecting only one column, but got %d", columns.length)); final String time = columns[0]; checkArgument(!isNullOrEmpty(time), "Missing time info to parse from"); LocalDateTime localDateTime = LocalDateTime.parse(time, DateTimeFormatter.ofPattern(pattern, Locale.ENGLISH)); return ZonedDateTime.of(localDateTime, ZoneId.of("America/Los_Angeles")); }
DefaultPacificDateTimeParser implements SingleLineValueParser<ZonedDateTime> { @Override public ZonedDateTime parse(final String... columns) { checkNotNull(columns, "No columns to parse from"); checkArgument(columns.length == 1, String.format("Expecting only one column, but got %d", columns.length)); final String time = columns[0]; checkArgument(!isNullOrEmpty(time), "Missing time info to parse from"); LocalDateTime localDateTime = LocalDateTime.parse(time, DateTimeFormatter.ofPattern(pattern, Locale.ENGLISH)); return ZonedDateTime.of(localDateTime, ZoneId.of("America/Los_Angeles")); } }
DefaultPacificDateTimeParser implements SingleLineValueParser<ZonedDateTime> { @Override public ZonedDateTime parse(final String... columns) { checkNotNull(columns, "No columns to parse from"); checkArgument(columns.length == 1, String.format("Expecting only one column, but got %d", columns.length)); final String time = columns[0]; checkArgument(!isNullOrEmpty(time), "Missing time info to parse from"); LocalDateTime localDateTime = LocalDateTime.parse(time, DateTimeFormatter.ofPattern(pattern, Locale.ENGLISH)); return ZonedDateTime.of(localDateTime, ZoneId.of("America/Los_Angeles")); } DefaultPacificDateTimeParser(final String pattern); }
DefaultPacificDateTimeParser implements SingleLineValueParser<ZonedDateTime> { @Override public ZonedDateTime parse(final String... columns) { checkNotNull(columns, "No columns to parse from"); checkArgument(columns.length == 1, String.format("Expecting only one column, but got %d", columns.length)); final String time = columns[0]; checkArgument(!isNullOrEmpty(time), "Missing time info to parse from"); LocalDateTime localDateTime = LocalDateTime.parse(time, DateTimeFormatter.ofPattern(pattern, Locale.ENGLISH)); return ZonedDateTime.of(localDateTime, ZoneId.of("America/Los_Angeles")); } DefaultPacificDateTimeParser(final String pattern); @Override ZonedDateTime parse(final String... columns); }
DefaultPacificDateTimeParser implements SingleLineValueParser<ZonedDateTime> { @Override public ZonedDateTime parse(final String... columns) { checkNotNull(columns, "No columns to parse from"); checkArgument(columns.length == 1, String.format("Expecting only one column, but got %d", columns.length)); final String time = columns[0]; checkArgument(!isNullOrEmpty(time), "Missing time info to parse from"); LocalDateTime localDateTime = LocalDateTime.parse(time, DateTimeFormatter.ofPattern(pattern, Locale.ENGLISH)); return ZonedDateTime.of(localDateTime, ZoneId.of("America/Los_Angeles")); } DefaultPacificDateTimeParser(final String pattern); @Override ZonedDateTime parse(final String... columns);  }