Skip to content

Instantly share code, notes, and snippets.

@jony4
Created September 29, 2018 07:45
Show Gist options
  • Save jony4/caf9d91fa3dab278dbd4eb85e0a7ff39 to your computer and use it in GitHub Desktop.
Save jony4/caf9d91fa3dab278dbd4eb85e0a7ff39 to your computer and use it in GitHub Desktop.
go日期包,parse踩坑
package main
import (
"fmt"
"time"
)
func main() {
t1, _ := time.Parse("2006-01-01", "2010-06-05")
fmt.Println(t1)
t2, _ := time.Parse("2006-01-02", "2010-06-05")
fmt.Println(t2)
}
@jony4
Copy link
Author

jony4 commented Sep 29, 2018

Play It

result:

2010-05-01 00:00:00 +0000 UTC
2010-06-05 00:00:00 +0000 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment