mirror of
https://github.com/araddon/dateparse.git
synced 2024-11-14 11:31:33 +08:00
doc update
This commit is contained in:
parent
cab5e508ca
commit
3bd2566cb7
@ -88,11 +88,7 @@ func main() {
|
|||||||
|
|
||||||
table.AddHeaders("Input", "Parsed, and Output as %v")
|
table.AddHeaders("Input", "Parsed, and Output as %v")
|
||||||
for _, dateExample := range examples {
|
for _, dateExample := range examples {
|
||||||
t, err := dateparse.ParseAny(dateExample)
|
table.AddRow(dateExample, fmt.Sprintf("%v", dateparse.MustParse(dateExample)))
|
||||||
if err != nil {
|
|
||||||
panic(err.Error())
|
|
||||||
}
|
|
||||||
table.AddRow(dateExample, fmt.Sprintf("%v", t))
|
|
||||||
}
|
}
|
||||||
fmt.Println(table.Render())
|
fmt.Println(table.Render())
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,10 @@ var examples = []string{
|
|||||||
"Mon Jan 02 15:04:05 -0700 2006",
|
"Mon Jan 02 15:04:05 -0700 2006",
|
||||||
"Monday, 02-Jan-06 15:04:05 MST",
|
"Monday, 02-Jan-06 15:04:05 MST",
|
||||||
"Mon, 02 Jan 2006 15:04:05 MST",
|
"Mon, 02 Jan 2006 15:04:05 MST",
|
||||||
|
"Tue, 11 Jul 2017 16:28:13 +0200 (CEST)",
|
||||||
|
"Mon, 02 Jan 2006 15:04:05 -0700",
|
||||||
"Mon Aug 10 15:44:11 UTC+0100 2015",
|
"Mon Aug 10 15:44:11 UTC+0100 2015",
|
||||||
"Fri Jul 03 2015 18:04:07 GMT+0100 (GMT Daylight Time)",
|
"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",
|
"12 Feb 2006, 19:17",
|
||||||
"2015-02-18 00:12:00 +0000 GMT",
|
"2015-02-18 00:12:00 +0000 GMT",
|
||||||
"2015-02-18 00:12:00 +0000 UTC",
|
"2015-02-18 00:12:00 +0000 UTC",
|
||||||
@ -44,10 +45,12 @@ var examples = []string{
|
|||||||
"2014/4/02 03:00:51",
|
"2014/4/02 03:00:51",
|
||||||
"2012/03/19 10:11:59",
|
"2012/03/19 10:11:59",
|
||||||
"2012/03/19 10:11:59.3186369",
|
"2012/03/19 10:11:59.3186369",
|
||||||
// yyyy-mm-dd
|
// yyyy-mm-ddT
|
||||||
"2009-08-12T22:15:09-07:00",
|
"2009-08-12T22:15:09-07:00",
|
||||||
"2009-08-12T22:15:09Z",
|
"2009-08-12T22:15:09Z",
|
||||||
"2009-08-12T22:15:09",
|
"2009-08-12T22:15:09",
|
||||||
|
"2006-01-02T15:04:05+0000",
|
||||||
|
// yyyy-mm-dd hh:mm:ss
|
||||||
"2014-04-26 17:24:37.3186369",
|
"2014-04-26 17:24:37.3186369",
|
||||||
"2014-04-26 17:24:37.318636",
|
"2014-04-26 17:24:37.318636",
|
||||||
"2012-08-03 18:31:59.257000000 +0000 UTC",
|
"2012-08-03 18:31:59.257000000 +0000 UTC",
|
||||||
@ -76,10 +79,7 @@ func main() {
|
|||||||
|
|
||||||
table.AddHeaders("Input", "Parsed, and Output as %v")
|
table.AddHeaders("Input", "Parsed, and Output as %v")
|
||||||
for _, dateExample := range examples {
|
for _, dateExample := range examples {
|
||||||
t, err := dateparse.ParseAny(dateExample)
|
t := dateparse.MustParse(dateExample)
|
||||||
if err != nil {
|
|
||||||
panic(err.Error())
|
|
||||||
}
|
|
||||||
table.AddRow(dateExample, fmt.Sprintf("%v", t))
|
table.AddRow(dateExample, fmt.Sprintf("%v", t))
|
||||||
}
|
}
|
||||||
fmt.Println(table.Render())
|
fmt.Println(table.Render())
|
||||||
@ -95,9 +95,10 @@ func main() {
|
|||||||
| Mon Jan 02 15:04:05 -0700 2006 | 2006-01-02 15:04:05 -0700 -0700 |
|
| Mon Jan 02 15:04:05 -0700 2006 | 2006-01-02 15:04:05 -0700 -0700 |
|
||||||
| Monday, 02-Jan-06 15:04:05 MST | 2006-01-02 15:04:05 +0000 MST |
|
| Monday, 02-Jan-06 15:04:05 MST | 2006-01-02 15:04:05 +0000 MST |
|
||||||
| Mon, 02 Jan 2006 15:04:05 MST | 2006-01-02 15:04:05 +0000 MST |
|
| Mon, 02 Jan 2006 15:04:05 MST | 2006-01-02 15:04:05 +0000 MST |
|
||||||
|
| Tue, 11 Jul 2017 16:28:13 +0200 (CEST) | 2017-07-11 16:28:13 +0200 +0200 |
|
||||||
|
| Mon, 02 Jan 2006 15:04:05 -0700 | 2006-01-02 15:04:05 -0700 -0700 |
|
||||||
| Mon Aug 10 15:44:11 UTC+0100 2015 | 2015-08-10 15:44:11 +0000 UTC |
|
| 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 |
|
| 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 |
|
| 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 +0000 |
|
| 2015-02-18 00:12:00 +0000 GMT | 2015-02-18 00:12:00 +0000 +0000 |
|
||||||
| 2015-02-18 00:12:00 +0000 UTC | 2015-02-18 00:12:00 +0000 +0000 |
|
| 2015-02-18 00:12:00 +0000 UTC | 2015-02-18 00:12:00 +0000 +0000 |
|
||||||
@ -127,6 +128,7 @@ func main() {
|
|||||||
| 2009-08-12T22:15:09-07:00 | 2009-08-12 22:15:09 -0700 PDT |
|
| 2009-08-12T22:15:09-07:00 | 2009-08-12 22:15:09 -0700 PDT |
|
||||||
| 2009-08-12T22:15:09Z | 2009-08-12 22:15:09 +0000 UTC |
|
| 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 |
|
| 2009-08-12T22:15:09 | 2009-08-12 22:15:09 +0000 UTC |
|
||||||
|
| 2006-01-02T15:04:05+0000 | 2006-01-02 15:04:05 +0000 +0000 |
|
||||||
| 2014-04-26 17:24:37.3186369 | 2014-04-26 17:24:37.3186369 +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 |
|
| 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 +0000 |
|
| 2012-08-03 18:31:59.257000000 +0000 UTC | 2012-08-03 18:31:59.257 +0000 +0000 |
|
||||||
|
Loading…
Reference in New Issue
Block a user