Last change
on this file since 102 was 102, checked in by imi, 18 years ago |
- added more timestamp formats to GeoImage - date import (all ISO formats)
- changed insert node into segment mode to not move the new node out of line (except pressing Alt)
- fixed bug in Merger, where two new (but unrelated) segments got merged
- fixed NPE in MapMover when pressing Ctrl+- or Ctrl-- and mouse outside of JOSM
- added "modified" as search criteria for searching after modified elements
|
File size:
739 bytes
|
Line | |
---|
1 | package org.openstreetmap.josm.tools;
|
---|
2 |
|
---|
3 | import java.text.ParseException;
|
---|
4 | import java.text.SimpleDateFormat;
|
---|
5 | import java.util.Date;
|
---|
6 |
|
---|
7 | /**
|
---|
8 | * Tries to parse a date as good as it can.
|
---|
9 | *
|
---|
10 | * @author Immanuel.Scholz
|
---|
11 | */
|
---|
12 | public class DateParser {
|
---|
13 |
|
---|
14 | private static final String[] formats = {
|
---|
15 | "MM/dd/yyyy HH:mm:ss",
|
---|
16 | "MM/dd/yyyy'T'HH:mm:ss.SSSZ",
|
---|
17 | "MM/dd/yyyy'T'HH:mm:ss.SSS",
|
---|
18 | "MM/dd/yyyy'T'HH:mm:ssZ",
|
---|
19 | "MM/dd/yyyy'T'HH:mm:ss",
|
---|
20 | };
|
---|
21 |
|
---|
22 | public static Date parse(String d) throws ParseException {
|
---|
23 | for (String parse : formats) {
|
---|
24 | SimpleDateFormat sdf = new SimpleDateFormat(parse);
|
---|
25 | try {return sdf.parse(d);} catch (ParseException pe) {}
|
---|
26 | }
|
---|
27 | throw new ParseException("No applicable parse format", 0);
|
---|
28 | }
|
---|
29 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.