List of usage examples for java.time ZonedDateTime parse
public static ZonedDateTime parse(CharSequence text)
From source file:org.silverpeas.core.calendar.CalendarEventOccurrenceGenerationTest.java
@Test public void nextOccurrenceAboutNonRecurrentHugeHourEventOnOneDayShouldWork() { CalendarEvent event = calendarEventForTest( Period.between(dateTimeInUTC(2017, 12, 12, 13, 30), dateTimeInUTC(2017, 12, 15, 14, 45))); ZonedDateTime from = ZonedDateTime.parse("2017-12-12T13:30:00+01:00[Europe/Paris]"); CalendarEventOccurrence result = generator.generateNextOccurrenceOf(event, from); assertThat(result, notNullValue());//from w ww . ja v a 2 s .co m assertThat(result.getStartDate(), is(dateTimeInUTC(2017, 12, 12, 13, 30))); assertThat(result.getEndDate(), is(dateTimeInUTC(2017, 12, 15, 14, 45))); from = ZonedDateTime.parse("2017-12-12T13:29:59Z"); result = generator.generateNextOccurrenceOf(event, from); assertThat(result, notNullValue()); assertThat(result.getStartDate(), is(dateTimeInUTC(2017, 12, 12, 13, 30))); assertThat(result.getEndDate(), is(dateTimeInUTC(2017, 12, 15, 14, 45))); from = ZonedDateTime.parse("2017-12-12T13:30:00Z"); result = generator.generateNextOccurrenceOf(event, from); assertThat(result, nullValue()); }
From source file:org.silverpeas.core.calendar.CalendarEventOccurrenceGenerationTest.java
@Test public void nextOccurrenceAboutRecurrentOneDayEventShouldWork() { CalendarEvent recurrentEvent = calendarEventForTest(Period.between(date(2017, 12, 12), date(2017, 12, 12))) .recur(Recurrence.every(1, TimeUnit.DAY).until(3)); ZonedDateTime from = ZonedDateTime.parse("2000-01-01T11:11:11-01:00[Atlantic/Azores]"); CalendarEventOccurrence result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue());//w w w .j a v a 2 s . co m assertThat(result.getStartDate(), is(date(2017, 12, 12))); assertThat(result.getEndDate(), is(date(2017, 12, 13))); from = ZonedDateTime.parse("2017-12-11T23:59:59Z"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue()); assertThat(result.getStartDate(), is(date(2017, 12, 12))); assertThat(result.getEndDate(), is(date(2017, 12, 13))); from = ZonedDateTime.parse("2017-12-12T00:00:00Z"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue()); assertThat(result.getStartDate(), is(date(2017, 12, 13))); assertThat(result.getEndDate(), is(date(2017, 12, 14))); from = ZonedDateTime.parse("2017-12-13T00:00:00Z"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue()); assertThat(result.getStartDate(), is(date(2017, 12, 14))); assertThat(result.getEndDate(), is(date(2017, 12, 15))); from = ZonedDateTime.parse("2017-12-14T00:00:00Z"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, nullValue()); }
From source file:org.silverpeas.core.calendar.CalendarEventOccurrenceGenerationTest.java
@Test public void nextOccurrenceAboutRecurrentOneDayEventWithExceptionShouldWork() { CalendarEvent recurrentEvent = calendarEventForTest(Period.between(date(2017, 12, 12), date(2017, 12, 12))) .recur(Recurrence.every(1, TimeUnit.DAY).until(3) .excludeEventOccurrencesStartingAt(date(2017, 12, 12), date(2017, 12, 14))); ZonedDateTime from = ZonedDateTime.parse("2000-01-01T11:11:11-01:00[Atlantic/Azores]"); CalendarEventOccurrence result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue());//from w w w .j a va 2s . co m assertThat(result.getStartDate(), is(date(2017, 12, 13))); assertThat(result.getEndDate(), is(date(2017, 12, 14))); from = ZonedDateTime.parse("2017-12-13T00:00:00Z"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, nullValue()); }
From source file:org.silverpeas.core.calendar.CalendarEventOccurrenceGenerationTest.java
@Test public void nextOccurrenceAboutRecurrentSeveralDayEventShouldWork() { CalendarEvent recurrentEvent = calendarEventForTest(Period.between(date(2017, 12, 12), date(2017, 12, 15))) .recur(Recurrence.every(1, TimeUnit.DAY).until(3)); ZonedDateTime from = ZonedDateTime.parse("2000-01-01T11:11:11-01:00[Atlantic/Azores]"); CalendarEventOccurrence result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue());//from w w w . j a va 2 s .c o m assertThat(result.getStartDate(), is(date(2017, 12, 12))); assertThat(result.getEndDate(), is(date(2017, 12, 15))); from = ZonedDateTime.parse("2017-12-11T23:59:59Z"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue()); assertThat(result.getStartDate(), is(date(2017, 12, 12))); assertThat(result.getEndDate(), is(date(2017, 12, 15))); from = ZonedDateTime.parse("2017-12-12T00:00:00Z"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue()); assertThat(result.getStartDate(), is(date(2017, 12, 13))); assertThat(result.getEndDate(), is(date(2017, 12, 16))); from = ZonedDateTime.parse("2017-12-13T00:00:00Z"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue()); assertThat(result.getStartDate(), is(date(2017, 12, 14))); assertThat(result.getEndDate(), is(date(2017, 12, 17))); from = ZonedDateTime.parse("2017-12-14T00:00:00Z"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, nullValue()); }
From source file:org.silverpeas.core.calendar.CalendarEventOccurrenceGenerationTest.java
@Test public void nextOccurrenceAboutRecurrentSeveralDayEventWithExceptionShouldWork() { CalendarEvent recurrentEvent = calendarEventForTest(Period.between(date(2017, 12, 12), date(2017, 12, 15))) .recur(Recurrence.every(1, TimeUnit.DAY).until(3) .excludeEventOccurrencesStartingAt(date(2017, 12, 12), date(2017, 12, 14))); ZonedDateTime from = ZonedDateTime.parse("2000-01-01T11:11:11-01:00[Atlantic/Azores]"); CalendarEventOccurrence result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue());/*from w ww . j a v a 2 s . c om*/ assertThat(result.getStartDate(), is(date(2017, 12, 13))); assertThat(result.getEndDate(), is(date(2017, 12, 16))); from = ZonedDateTime.parse("2017-12-13T00:00:00Z"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, nullValue()); }
From source file:org.silverpeas.core.calendar.CalendarEventOccurrenceGenerationTest.java
@Test public void nextOccurrenceAboutRecurrentHourEventShouldWork() { CalendarEvent recurrentEvent = calendarEventForTest( Period.between(dateTimeInUTC(2017, 12, 12, 13, 30), dateTimeInUTC(2017, 12, 12, 14, 45))) .recur(Recurrence.every(1, TimeUnit.DAY).until(3)); ZonedDateTime from = ZonedDateTime.parse("2000-01-01T11:11:11-01:00[Atlantic/Azores]"); CalendarEventOccurrence result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue());// w w w. j a v a 2 s . c om assertThat(result.getStartDate(), is(dateTimeInUTC(2017, 12, 12, 13, 30))); assertThat(result.getEndDate(), is(dateTimeInUTC(2017, 12, 12, 14, 45))); from = ZonedDateTime.parse("2017-12-12T13:29:59Z"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue()); assertThat(result.getStartDate(), is(dateTimeInUTC(2017, 12, 12, 13, 30))); assertThat(result.getEndDate(), is(dateTimeInUTC(2017, 12, 12, 14, 45))); from = ZonedDateTime.parse("2017-12-12T13:30:00Z"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue()); assertThat(result.getStartDate(), is(dateTimeInUTC(2017, 12, 13, 13, 30))); assertThat(result.getEndDate(), is(dateTimeInUTC(2017, 12, 13, 14, 45))); from = ZonedDateTime.parse("2017-12-13T13:30:00Z"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue()); assertThat(result.getStartDate(), is(dateTimeInUTC(2017, 12, 14, 13, 30))); assertThat(result.getEndDate(), is(dateTimeInUTC(2017, 12, 14, 14, 45))); from = ZonedDateTime.parse("2017-12-14T13:30:00Z"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, nullValue()); }
From source file:ddf.catalog.registry.converter.RegistryPackageConverter.java
private static List<Date> getSlotDateAttributes(SlotType1 slot) { List<Date> dates = new ArrayList<>(); if (slot.isSetValueList()) { ValueListType valueList = slot.getValueList().getValue(); if (valueList.isSetValue()) { List<String> values = valueList.getValue(); for (String dateString : values) { Date date = Date.from(ZonedDateTime.parse(dateString).toInstant()); if (date != null) { dates.add(date);// w w w . j a va 2 s . com } } } } return dates; }
From source file:org.silverpeas.core.calendar.CalendarEventOccurrenceGenerationTest.java
@Test public void nextOccurrenceAboutRecurrentHourEventStartingOnSummerShouldWork() { final OffsetDateTime startDateTimeOnParis = dateTimeOnParis(2017, 7, 11, 23, 0); final OffsetDateTime endDateTimeOnParis = dateTimeOnParis(2017, 7, 12, 0, 45); assertThat(startDateTimeOnParis.withOffsetSameInstant(ZoneOffset.UTC), is(dateTimeInUTC(2017, 7, 11, 21, 0))); assertThat(endDateTimeOnParis.withOffsetSameInstant(ZoneOffset.UTC), is(dateTimeInUTC(2017, 7, 11, 22, 45))); assertThat(dateTimeOnParis(2017, 12, 11, 23, 0).withOffsetSameInstant(ZoneOffset.UTC), is(dateTimeInUTC(2017, 12, 11, 22, 0))); assertThat(dateTimeOnParis(2017, 12, 12, 0, 45).withOffsetSameInstant(ZoneOffset.UTC), is(dateTimeInUTC(2017, 12, 11, 23, 45))); CalendarEvent recurrentEvent = calendarEventForTest( Period.between(startDateTimeOnParis, endDateTimeOnParis), PARIS_ZONE_ID) .recur(Recurrence.every(1, TimeUnit.MONTH).until(10)); ZonedDateTime from = ZonedDateTime.parse("2017-12-11T21:59:59-01:00[Atlantic/Azores]"); CalendarEventOccurrence result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue());//from w ww . jav a 2 s . c om assertThat(result.getStartDate(), is(dateTimeInUTC(2018, 1, 11, 22, 0))); assertThat(result.getEndDate(), is(dateTimeInUTC(2018, 1, 11, 23, 45))); from = ZonedDateTime.parse("2017-12-11T22:00:00-01:00[Atlantic/Azores]"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue()); assertThat(result.getStartDate(), is(dateTimeInUTC(2018, 1, 11, 22, 0))); assertThat(result.getEndDate(), is(dateTimeInUTC(2018, 1, 11, 23, 45))); from = ZonedDateTime.parse("2017-12-11T22:59:59+00:00[UTC]"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue()); assertThat(result.getStartDate(), is(dateTimeInUTC(2018, 1, 11, 22, 0))); assertThat(result.getEndDate(), is(dateTimeInUTC(2018, 1, 11, 23, 45))); from = ZonedDateTime.parse("2017-12-11T23:00:00+00:00[UTC]"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue()); assertThat(result.getStartDate(), is(dateTimeInUTC(2018, 1, 11, 22, 0))); assertThat(result.getEndDate(), is(dateTimeInUTC(2018, 1, 11, 23, 45))); from = ZonedDateTime.parse("2017-12-11T22:59:59+01:00[Europe/Paris]"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue()); assertThat(result.getStartDate(), is(dateTimeInUTC(2017, 12, 11, 22, 0))); assertThat(result.getEndDate(), is(dateTimeInUTC(2017, 12, 11, 23, 45))); from = ZonedDateTime.parse("2017-12-11T23:00:00+01:00[Europe/Paris]"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue()); assertThat(result.getStartDate(), is(dateTimeInUTC(2018, 1, 11, 22, 0))); assertThat(result.getEndDate(), is(dateTimeInUTC(2018, 1, 11, 23, 45))); }
From source file:org.silverpeas.core.calendar.CalendarEventOccurrenceGenerationTest.java
@Test public void nextOccurrenceAboutRecurrentHourEventStartingOnSummerAndNowAboutHourChangingShouldWork() { final OffsetDateTime startDateTimeOnParis = dateTimeOnParis(2017, 7, 29, 3, 0); final OffsetDateTime endDateTimeOnParis = dateTimeOnParis(2017, 7, 29, 4, 30); assertThat(startDateTimeOnParis.withOffsetSameInstant(ZoneOffset.UTC), is(dateTimeInUTC(2017, 7, 29, 1, 0))); assertThat(endDateTimeOnParis.withOffsetSameInstant(ZoneOffset.UTC), is(dateTimeInUTC(2017, 7, 29, 2, 30))); assertThat(dateTimeOnParis(2017, 10, 28, 23, 59).withOffsetSameInstant(ZoneOffset.UTC), is(dateTimeInUTC(2017, 10, 28, 21, 59))); assertThat(dateTimeOnParis(2017, 10, 29, 0, 0).withOffsetSameInstant(ZoneOffset.UTC), is(dateTimeInUTC(2017, 10, 28, 22, 0))); assertThat(dateTimeOnParis(2017, 10, 29, 2, 0).withOffsetSameInstant(ZoneOffset.UTC), is(dateTimeInUTC(2017, 10, 29, 0, 0))); assertThat(dateTimeOnParis(2017, 10, 29, 2, 59).withOffsetSameInstant(ZoneOffset.UTC), is(dateTimeInUTC(2017, 10, 29, 0, 59))); assertThat(dateTimeOnParis(2017, 10, 29, 3, 0).withOffsetSameInstant(ZoneOffset.UTC), is(dateTimeInUTC(2017, 10, 29, 2, 0))); assertThat(dateTimeOnParis(2018, 3, 25, 2, 59).withOffsetSameInstant(ZoneOffset.UTC), is(dateTimeInUTC(2018, 3, 25, 1, 59))); assertThat(dateTimeOnParis(2018, 3, 25, 3, 0).withOffsetSameInstant(ZoneOffset.UTC), is(dateTimeInUTC(2018, 3, 25, 1, 0))); CalendarEvent recurrentEvent = calendarEventForTest( Period.between(startDateTimeOnParis, endDateTimeOnParis), PARIS_ZONE_ID) .recur(Recurrence.every(1, TimeUnit.MONTH).until(100)); ZonedDateTime from = ZonedDateTime.parse("2017-10-29T00:59:59-01:00[Atlantic/Azores]"); CalendarEventOccurrence result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue());//from w ww . ja va 2 s . c o m assertThat(result.getStartDate(), is(dateTimeInUTC(2017, 10, 29, 2, 0))); assertThat(result.getEndDate(), is(dateTimeInUTC(2017, 10, 29, 3, 30))); from = ZonedDateTime.parse("2017-10-29T01:00:00-01:00[Atlantic/Azores]"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue()); assertThat(result.getStartDate(), is(dateTimeInUTC(2017, 11, 29, 2, 0))); assertThat(result.getEndDate(), is(dateTimeInUTC(2017, 11, 29, 3, 30))); from = ZonedDateTime.parse("2017-10-29T01:59:59+00:00[UTC]"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue()); assertThat(result.getStartDate(), is(dateTimeInUTC(2017, 10, 29, 2, 0))); assertThat(result.getEndDate(), is(dateTimeInUTC(2017, 10, 29, 3, 30))); from = ZonedDateTime.parse("2017-10-29T02:00:00+00:00[UTC]"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue()); assertThat(result.getStartDate(), is(dateTimeInUTC(2017, 11, 29, 2, 0))); assertThat(result.getEndDate(), is(dateTimeInUTC(2017, 11, 29, 3, 30))); from = ZonedDateTime.parse("2017-10-29T02:59:59+01:00[Europe/Paris]"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue()); assertThat(result.getStartDate(), is(dateTimeInUTC(2017, 10, 29, 2, 0))); assertThat(result.getEndDate(), is(dateTimeInUTC(2017, 10, 29, 3, 30))); from = ZonedDateTime.parse("2017-10-29T03:00:00+01:00[Europe/Paris]"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue()); assertThat(result.getStartDate(), is(dateTimeInUTC(2017, 11, 29, 2, 0))); assertThat(result.getEndDate(), is(dateTimeInUTC(2017, 11, 29, 3, 30))); from = ZonedDateTime.parse("2018-01-29T02:59:59+01:00[Europe/Paris]"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue()); assertThat(result.getStartDate(), is(dateTimeInUTC(2018, 1, 29, 2, 0))); assertThat(result.getEndDate(), is(dateTimeInUTC(2018, 1, 29, 3, 30))); from = ZonedDateTime.parse("2018-01-29T03:00:00+01:00[Europe/Paris]"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue()); assertThat(result.getStartDate(), is(dateTimeInUTC(2018, 3, 29, 1, 0))); assertThat(result.getEndDate(), is(dateTimeInUTC(2018, 3, 29, 2, 30))); from = ZonedDateTime.parse("2018-02-28T02:59:59+01:00[Europe/Paris]"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue()); assertThat(result.getStartDate(), is(dateTimeInUTC(2018, 3, 29, 1, 0))); assertThat(result.getEndDate(), is(dateTimeInUTC(2018, 3, 29, 2, 30))); from = ZonedDateTime.parse("2018-02-28T03:00:00+01:00[Europe/Paris]"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue()); assertThat(result.getStartDate(), is(dateTimeInUTC(2018, 3, 29, 1, 0))); assertThat(result.getEndDate(), is(dateTimeInUTC(2018, 3, 29, 2, 30))); from = ZonedDateTime.parse("2018-03-29T02:59:59+01:00[Europe/Paris]"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue()); assertThat(result.getStartDate(), is(dateTimeInUTC(2018, 3, 29, 1, 0))); assertThat(result.getEndDate(), is(dateTimeInUTC(2018, 3, 29, 2, 30))); from = ZonedDateTime.parse("2018-03-29T03:00:00+01:00[Europe/Paris]"); result = generator.generateNextOccurrenceOf(recurrentEvent, from); assertThat(result, notNullValue()); assertThat(result.getStartDate(), is(dateTimeInUTC(2018, 4, 29, 1, 0))); assertThat(result.getEndDate(), is(dateTimeInUTC(2018, 4, 29, 2, 30))); }
From source file:at.ac.ait.ariadne.routeformat.example.IntermodalRouteExample.java
private IntermediateStop createIntermediateStopNeueDonau() { ZonedDateTime arrivalTime = ZonedDateTime.parse("2016-01-01T15:22:30+01:00"); ZonedDateTime departureTime = arrivalTime.plus(60, ChronoUnit.SECONDS); return IntermediateStop.builder().withStop(neueDonauSubwayStop).withPlannedArrivalTime(arrivalTime) .withPlannedDepartureTime(departureTime).withEstimatedArrivalTime(arrivalTime) .withEstimatedDepartureTime(departureTime).build(); }