mirror of
https://github.com/araddon/dateparse.git
synced 2024-11-10 11:51:54 +08:00
document new parseformat
This commit is contained in:
parent
affe10976d
commit
934b3f146d
@ -36,6 +36,11 @@ t, err := dateparse.ParseLocal("3/1/2014")
|
|||||||
// Equivalent to
|
// Equivalent to
|
||||||
t, err := dateparse.ParseIn("3/1/2014", time.Local)
|
t, err := dateparse.ParseIn("3/1/2014", time.Local)
|
||||||
|
|
||||||
|
|
||||||
|
// Return a string that represents the layout to parse the given date-time.
|
||||||
|
layout, err := dateparse.ParseFormat("May 8, 2009 5:57:51 PM")
|
||||||
|
> "Jan 2, 2006 3:04:05 PM"
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
cli tool for testing dateformats
|
cli tool for testing dateformats
|
||||||
|
@ -30,8 +30,14 @@ func main() {
|
|||||||
|
|
||||||
datestr = flag.Args()[0]
|
datestr = flag.Args()[0]
|
||||||
|
|
||||||
|
layout, err := dateparse.ParseFormat(datestr)
|
||||||
|
if err != nil {
|
||||||
|
panic(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
zonename, _ := time.Now().In(time.Local).Zone()
|
zonename, _ := time.Now().In(time.Local).Zone()
|
||||||
fmt.Printf("\nYour Current time.Local zone is %v\n", zonename)
|
fmt.Printf("\nYour Current time.Local zone is %v\n", zonename)
|
||||||
|
fmt.Printf("\nLayout String: dateparse.ParseFormat() => %v\n", layout)
|
||||||
var loc *time.Location
|
var loc *time.Location
|
||||||
if timezone != "" {
|
if timezone != "" {
|
||||||
// NOTE: This is very, very important to understand
|
// NOTE: This is very, very important to understand
|
||||||
|
Loading…
Reference in New Issue
Block a user