@Test public void getDateFromStringEuropeParis() throws ParseException { final Date expected = this.getDate("2023-02-15 04:13:38.123+0100", "yyyy-MM-dd HH:mm:ss.SSSZ", TimeZone.getTimeZone("Europe/Paris")); final String dateText = "2023-02-15T04:13:38.123+01:00[Europe/Paris]"; final Date actual = DateHelper.dateFromIsoString(dateText); assertThat(actual).isEqualTo(expected); }
public static Date dateFromIsoString(final String dateText) { final DateTimeFormatter dtf = DateTimeFormatter.ISO_DATE_TIME; final ZonedDateTime zonedDateTime = ZonedDateTime.parse(dateText, dtf); return Date.from(zonedDateTime.toInstant()); }
DateHelper { public static Date dateFromIsoString(final String dateText) { final DateTimeFormatter dtf = DateTimeFormatter.ISO_DATE_TIME; final ZonedDateTime zonedDateTime = ZonedDateTime.parse(dateText, dtf); return Date.from(zonedDateTime.toInstant()); } }
DateHelper { public static Date dateFromIsoString(final String dateText) { final DateTimeFormatter dtf = DateTimeFormatter.ISO_DATE_TIME; final ZonedDateTime zonedDateTime = ZonedDateTime.parse(dateText, dtf); return Date.from(zonedDateTime.toInstant()); } private  DateHelper(); }
DateHelper { public static Date dateFromIsoString(final String dateText) { final DateTimeFormatter dtf = DateTimeFormatter.ISO_DATE_TIME; final ZonedDateTime zonedDateTime = ZonedDateTime.parse(dateText, dtf); return Date.from(zonedDateTime.toInstant()); } private  DateHelper(); static Date getGmtDate(); static Date dateFromIsoString(final String dateText); }
DateHelper { public static Date dateFromIsoString(final String dateText) { final DateTimeFormatter dtf = DateTimeFormatter.ISO_DATE_TIME; final ZonedDateTime zonedDateTime = ZonedDateTime.parse(dateText, dtf); return Date.from(zonedDateTime.toInstant()); } private  DateHelper(); static Date getGmtDate(); static Date dateFromIsoString(final String dateText);  }