Guest User

Untitled

a guest
Jul 19th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. "2017-02-12 06:59:00 +1300"
  2.  
  3. DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("YYYY-MM-dd HH:mm:ss ZZ");
  4.  
  5. this.actionTime = dateTimeFormatter.parse(actionTime, ZonedDateTime::from);
  6.  
  7. public DateCalculatorTest(String actionTime, int expectedDayOfWeek) {
  8.  
  9. DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("YYYY-MM-dd HH:mm:ss ZZ");
  10. DateTimeFormatter localTimeFormatter = DateTimeFormatter.ofPattern("YYYY-MM-dd");
  11. this.actionTime= dateTimeFormatter.parse(actionTime, ZonedDateTime::from);
  12. this.expectedDayOfWeek= expectedDayOfWeek;
  13. }
  14.  
  15. Text '2017-02-12 06:59:00 +1300' could not be parsed: Unable to obtain ZonedDateTime from TemporalAccessor: {WeekBasedYear[WeekFields[SUNDAY,1]]=2017, DayOfMonth=12, MonthOfYear=2, OffsetSeconds=46800},ISO resolved to 06:59 of type java.time.format.Parsed
  16.  
  17. YYYY-MM-dd HH:mm:ss ZZ
  18.  
  19. yyyy-MM-dd HH:mm:ss ZZ
  20.  
  21. this.actionTime = ZonedDateTime.parse(actionTime, dateTimeFormatter.withZone(ZoneId.of(<<yourxoneid>>)));
Add Comment
Please, Sign In to add comment