diff --git a/README.md b/README.md index 5fba297..f9d90d1 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ var examples = []string{ "Mon Aug 10 15:44:11 UTC+0100 2015", "Fri Jul 03 2015 18:04:07 GMT+0100 (GMT Daylight Time)", "Mon, 02 Jan 2006 15:04:05 -0700", + "12 Feb 2006, 19:17", "2015-02-18 00:12:00 +0000 GMT", "2015-02-18 00:12:00 +0000 UTC", "3/31/2014", @@ -37,6 +38,10 @@ var examples = []string{ "04/08/2014 22:05", "04/2/2014 03:00:51", "8/8/1965 12:00:00 AM", + "8/8/1965 01:00:01 PM", + "8/8/1965 01:00 PM", + "8/8/1965 1:00 PM", + "8/8/1965 12:00 AM", "4/02/2014 03:00:51", "03/19/2012 10:11:59", "03/19/2012 10:11:59.3186369", @@ -103,6 +108,7 @@ func main() { | Mon Aug 10 15:44:11 UTC+0100 2015 | 2015-08-10 15:44:11 +0000 UTC | | Fri Jul 03 2015 18:04:07 GMT+0100 (GMT Daylight Time) | 2015-07-03 18:04:07 +0100 GMT | | Mon, 02 Jan 2006 15:04:05 -0700 | 2006-01-02 15:04:05 -0700 -0700 | +| 12 Feb 2006, 19:17 | 2006-02-12 19:17:00 +0000 UTC | | 2015-02-18 00:12:00 +0000 GMT | 2015-02-18 00:12:00 +0000 UTC | | 2015-02-18 00:12:00 +0000 UTC | 2015-02-18 00:12:00 +0000 UTC | | 3/31/2014 | 2014-03-31 00:00:00 +0000 UTC | @@ -112,7 +118,11 @@ func main() { | 4/8/2014 22:05 | 2014-04-08 22:05:00 +0000 UTC | | 04/08/2014 22:05 | 2014-04-08 22:05:00 +0000 UTC | | 04/2/2014 03:00:51 | 2014-04-02 03:00:51 +0000 UTC | -| 8/8/1965 12:00:00 AM | 1965-08-08 12:00:00 +0000 UTC | +| 8/8/1965 12:00:00 AM | 1965-08-08 00:00:00 +0000 UTC | +| 8/8/1965 01:00:01 PM | 1965-08-08 13:00:01 +0000 UTC | +| 8/8/1965 01:00 PM | 1965-08-08 13:00:00 +0000 UTC | +| 8/8/1965 1:00 PM | 1965-08-08 13:00:00 +0000 UTC | +| 8/8/1965 12:00 AM | 1965-08-08 00:00:00 +0000 UTC | | 4/02/2014 03:00:51 | 2014-04-02 03:00:51 +0000 UTC | | 03/19/2012 10:11:59 | 2012-03-19 10:11:59 +0000 UTC | | 03/19/2012 10:11:59.3186369 | 2012-03-19 10:11:59.3186369 +0000 UTC | @@ -128,6 +138,7 @@ func main() { | 2009-08-12T22:15:09Z | 2009-08-12 22:15:09 +0000 UTC | | 2009-08-12T22:15:09 | 2009-08-12 22:15:09 +0000 UTC | | 2014-04-26 17:24:37.3186369 | 2014-04-26 17:24:37.3186369 +0000 UTC | +| 2014-04-26 17:24:37.318636 | 2014-04-26 17:24:37.318636 +0000 UTC | | 2012-08-03 18:31:59.257000000 +0000 UTC | 2012-08-03 18:31:59.257 +0000 UTC | | 2015-09-30 18:48:56.35272715 +0000 UTC | 2015-09-30 18:48:56.35272715 +0000 UTC | | 2012-08-03 18:31:59.257000000 | 2012-08-03 18:31:59.257 +0000 UTC | @@ -144,4 +155,5 @@ func main() { | 1332151919 | 2012-03-19 03:11:59 -0700 PDT | | 1384216367189 | 2013-11-11 16:32:47.189 -0800 PST | +-------------------------------------------------------+----------------------------------------+ + ``` \ No newline at end of file diff --git a/example/main.go b/example/main.go index 19fac2d..662c2b1 100644 --- a/example/main.go +++ b/example/main.go @@ -28,6 +28,10 @@ var examples = []string{ "04/08/2014 22:05", "04/2/2014 03:00:51", "8/8/1965 12:00:00 AM", + "8/8/1965 01:00:01 PM", + "8/8/1965 01:00 PM", + "8/8/1965 1:00 PM", + "8/8/1965 12:00 AM", "4/02/2014 03:00:51", "03/19/2012 10:11:59", "03/19/2012 10:11:59.3186369", @@ -102,7 +106,11 @@ func main() { | 4/8/2014 22:05 | 2014-04-08 22:05:00 +0000 UTC | | 04/08/2014 22:05 | 2014-04-08 22:05:00 +0000 UTC | | 04/2/2014 03:00:51 | 2014-04-02 03:00:51 +0000 UTC | -| 8/8/1965 12:00:00 AM | 1965-08-08 12:00:00 +0000 UTC | +| 8/8/1965 12:00:00 AM | 1965-08-08 00:00:00 +0000 UTC | +| 8/8/1965 01:00:01 PM | 1965-08-08 13:00:01 +0000 UTC | +| 8/8/1965 01:00 PM | 1965-08-08 13:00:00 +0000 UTC | +| 8/8/1965 1:00 PM | 1965-08-08 13:00:00 +0000 UTC | +| 8/8/1965 12:00 AM | 1965-08-08 00:00:00 +0000 UTC | | 4/02/2014 03:00:51 | 2014-04-02 03:00:51 +0000 UTC | | 03/19/2012 10:11:59 | 2012-03-19 10:11:59 +0000 UTC | | 03/19/2012 10:11:59.3186369 | 2012-03-19 10:11:59.3186369 +0000 UTC | diff --git a/parseany.go b/parseany.go index b76001f..4e2cf21 100644 --- a/parseany.go +++ b/parseany.go @@ -623,6 +623,8 @@ iterRunes: case len("2006/01/2 15:04"): if t, err = time.Parse("2006/01/2 15:04", datestr); err != nil { t, err = time.Parse("2006/1/02 15:04", datestr) + } else if t, err = time.Parse("2006/1/02 15:04", datestr); err != nil { + t, err = time.Parse("2006/1/02 15:04", datestr) } default: t, err = time.Parse("2006/1/2 15:04", datestr) @@ -634,6 +636,8 @@ iterRunes: case len("01/2/2006 15:04"): if t, err = time.Parse("01/2/2006 15:04", datestr); err != nil { t, err = time.Parse("1/02/2006 15:04", datestr) + } else if t, err = time.Parse("1/02/2006 15:04", datestr); err != nil { + t, err = time.Parse("1/02/2006 15:04", datestr) } default: t, err = time.Parse("1/2/2006 15:04", datestr)