diff options
Diffstat (limited to 'src/org/noreply/fancydress')
-rw-r--r-- | src/org/noreply/fancydress/misc/Util.java | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/org/noreply/fancydress/misc/Util.java b/src/org/noreply/fancydress/misc/Util.java index f9962bf..a111b88 100644 --- a/src/org/noreply/fancydress/misc/Util.java +++ b/src/org/noreply/fancydress/misc/Util.java @@ -177,31 +177,39 @@ public class Util { } } /** - * Parse an ISO date yyyy-MM-dd hh:mm:ss. + * Parse an ISO date yyyy-MM-dd HH:mm:ss. * * @param s a string holding a date * @return Date the date represented in <code>s</code> * @throws ParseException if <code>s</code> is not a valid date of that format */ public static Date parseDateTime(String s) { - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); format.setTimeZone(TimeZone.getTimeZone("GMT")); format.setLenient(false); try { return format.parse(s); } catch (ParseException e) { - return null; + /* FIXME: US date.. */ + format = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); + format.setTimeZone(TimeZone.getTimeZone("GMT")); + format.setLenient(false); + try { + return format.parse(s); + } catch (ParseException e2) { + return null; + } } } /** - * Parse an ISO date yyyy-MM-dd hh:mm:ss.SSSS. + * Parse an ISO date yyyy-MM-dd HH:mm:ss.SSSS. * * @param s a string holding a date * @return Date the date represented in <code>s</code> * @throws ParseException if <code>s</code> is not a valid date of that format */ public static Date parseDateTimeMS(String s) { - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSSS"); + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSS"); format.setTimeZone(TimeZone.getTimeZone("GMT")); format.setLenient(false); try { |