2
0
mirror of https://github.com/araddon/dateparse.git synced 2026-07-31 02:58:33 +08:00

new date format

This commit is contained in:
Aaron Raddon
2014-05-11 18:08:56 -07:00
parent 9486d2dfd3
commit aa93a85b69
2 changed files with 32 additions and 18 deletions

View File

@@ -51,6 +51,7 @@ iterRunes:
case 64: // starts digit then dash 02- 1 << 2 << 5
// 2006-01-02T15:04:05Z07:00
// 2006-01-02T15:04:05.999999999Z07:00
// 2012-08-03 18:31:59.257000000
// 2014-04-26 17:24:37.3186369
// 2016-03-14 00:00:00.000
// 2014-05-11 08:20:13,787
@@ -64,6 +65,7 @@ iterRunes:
}
case 65: // starts digit then dash 02- then whitespace 1 << 2 << 5 + 1
// 2014-04-26 17:24:37.3186369
// 2012-08-03 18:31:59.257000000
// 2016-03-14 00:00:00.000
// 2014-05-11 08:20:13,787
// 2014-04-26 05:24:37 PM
@@ -207,8 +209,15 @@ iterRunes:
}
case 65: // starts digit then dash 02- then whitespace 1 << 2 << 5 + 3
// 2014-04-26 17:24:37.3186369
// 2012-08-03 18:31:59.257000000
// 2016-03-14 00:00:00.000
if len(datestr) == len("2014-04-26 05:24:37.3186369") {
if len(datestr) == len("2012-08-03 18:31:59.257000000") {
if t, err := time.Parse("2006-01-02 15:04:05.000000000", datestr); err == nil {
return t, nil
} else {
u.Error(err)
}
} else if len(datestr) == len("2014-04-26 05:24:37.3186369") {
if t, err := time.Parse("2006-01-02 15:04:05.0000000", datestr); err == nil {
return t, nil
} else {