diff options
author | snowleo <schneeleo@gmail.com> | 2011-08-23 13:20:35 +0200 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2011-08-23 13:22:11 +0200 |
commit | 5de354af86a20c3422a436f1611b7c29702a490a (patch) | |
tree | cd5236a63705751c87a104c8fef3d903e27acad8 | |
parent | bb32ec9567879dbc9432548333d3f7254cb8c351 (diff) | |
download | Essentials-5de354af86a20c3422a436f1611b7c29702a490a.tar Essentials-5de354af86a20c3422a436f1611b7c29702a490a.tar.gz Essentials-5de354af86a20c3422a436f1611b7c29702a490a.tar.lz Essentials-5de354af86a20c3422a436f1611b7c29702a490a.tar.xz Essentials-5de354af86a20c3422a436f1611b7c29702a490a.zip |
midnight = 12am
noon = 12pm
-rwxr-xr-x | Essentials/src/com/earth2me/essentials/DescParseTickFormat.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Essentials/src/com/earth2me/essentials/DescParseTickFormat.java b/Essentials/src/com/earth2me/essentials/DescParseTickFormat.java index a64f8e3c7..0fd2e9047 100755 --- a/Essentials/src/com/earth2me/essentials/DescParseTickFormat.java +++ b/Essentials/src/com/earth2me/essentials/DescParseTickFormat.java @@ -155,10 +155,6 @@ public final class DescParseTickFormat int hours = 0; int minutes = 0; - if (desc.endsWith("pm")) - { - hours += 12; - } desc = desc.toLowerCase().replaceAll("[^0-9]", ""); @@ -189,6 +185,16 @@ public final class DescParseTickFormat { throw new NumberFormatException(); } + + if (desc.endsWith("pm") && hours != 12) + { + hours += 12; + } + + if (desc.endsWith("am") && hours == 12) + { + hours -= 12; + } return hoursMinutesToTicks(hours, minutes); } |