Changeset 17987 in josm for trunk/src/org/openstreetmap/josm/tools/date/DateUtils.java
- Timestamp:
- 2021-07-10T22:54:00+02:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/date/DateUtils.java
r17911 r17987 136 136 } 137 137 return local.toInstant(); 138 } else if (checkLayout(str, "xxxx/xx/xx xx:xx:xx.xxxxxx")) { 139 return ZonedDateTime.of( 140 parsePart4(str, 0), 141 parsePart2(str, 5), 142 parsePart2(str, 8), 143 parsePart2(str, 11), 144 parsePart2(str, 14), 145 parsePart2(str, 17), 146 parsePart6(str, 20) * 1_000, 147 ZoneOffset.UTC 148 ).toInstant(); 138 149 } else { 139 150 // example date format "18-AUG-08 13:33:03" … … 232 243 } 233 244 245 private static int parsePart6(String str, int off) { 246 return 100000 * num(str.charAt(off)) 247 + 10000 * num(str.charAt(off + 1)) 248 + 1000 * num(str.charAt(off + 2)) 249 + 100 * num(str.charAt(off + 3)) 250 + 10 * num(str.charAt(off + 4)) 251 + num(str.charAt(off + 5)); 252 } 253 234 254 /** 235 255 * Returns a new {@code SimpleDateFormat} for date only, according to <a href="https://en.wikipedia.org/wiki/ISO_8601">ISO 8601</a>.
Note:
See TracChangeset
for help on using the changeset viewer.