Changeset 17114 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2020-10-08T19:48:57+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/date/DateUtils.java
r17104 r17114 68 68 public static long tsFromString(String str) { 69 69 // "2007-07-25T09:26:24{Z|{+|-}01[:00]}" 70 if (checkLayout(str, "xxxx-xx-xx")) { 70 if (checkLayout(str, "xxxx-xx-xx") || 71 checkLayout(str, "xxxx-xx") || 72 checkLayout(str, "xxxx")) { 71 73 final ZonedDateTime local = ZonedDateTime.of( 72 74 parsePart4(str, 0), 73 parsePart2(str, 5),74 parsePart2(str, 8),75 str.length() > 5 ? parsePart2(str, 5) : 1, 76 str.length() > 8 ? parsePart2(str, 8) : 1, 75 77 0, 0, 0, 0, ZoneOffset.UTC); 76 78 return local.toInstant().toEpochMilli(); … … 129 131 try { 130 132 // slow path for fractional seconds different from millisecond precision 131 return Instant.parse(str).toEpochMilli();133 return ZonedDateTime.parse(str).toInstant().toEpochMilli(); 132 134 } catch (IllegalArgumentException | DateTimeParseException ex) { 133 135 throw new UncheckedParseException("The date string (" + str + ") could not be parsed.", ex);
Note:
See TracChangeset
for help on using the changeset viewer.