fix kitchen times, show an example of constants
This commit is contained in:
parent
0bfce8f576
commit
a6ec750f4a
@ -20,7 +20,7 @@ func main() {
|
||||
// general pattern with which to format the given
|
||||
// time. Here are a few more examples of time
|
||||
// formatting.
|
||||
p(t.Format("4:05PM"))
|
||||
p(t.Format("3:04PM"))
|
||||
p(t.Format("Mon Jan _2 15:04:05 2006"))
|
||||
p(t.Format("2006-01-02T15:04:05.999999-07:00"))
|
||||
|
||||
@ -39,7 +39,7 @@ func main() {
|
||||
withNanos,
|
||||
"2012-11-01T22:08:41.117442+00:00")
|
||||
p(t1)
|
||||
kitchen := "4:05PM"
|
||||
kitchen := "3:04PM"
|
||||
t2, e := time.Parse(kitchen, "8:41PM")
|
||||
p(t2)
|
||||
|
||||
@ -48,4 +48,8 @@ func main() {
|
||||
ansic := "Mon Jan _2 15:04:05 2006"
|
||||
_, e = time.Parse(ansic, "8:41PM")
|
||||
p(e)
|
||||
|
||||
// There are several predefined formats that you can
|
||||
// use for both formatting and parsing.
|
||||
p(t.Format(time.Kitchen))
|
||||
}
|
||||
|
@ -1,9 +1,10 @@
|
||||
$ go run time-formatting-parsing.go
|
||||
2012-11-01T15:17:41-07:00
|
||||
17:41PM
|
||||
Thu Nov 1 15:17:41 2012
|
||||
2012-11-01T15:17:41.256589-07:00
|
||||
2012-11-01T15:17:41-00:00
|
||||
2012-11-02T09:35:03-07:00
|
||||
9:35AM
|
||||
Fri Nov 2 09:35:03 2012
|
||||
2012-11-02T09:35:03.982519-07:00
|
||||
2012-11-02T09:35:03-00:00
|
||||
0001-01-01 00:00:00 +0000 UTC
|
||||
0000-01-01 12:08:41 +0000 UTC
|
||||
0000-01-01 20:41:00 +0000 UTC
|
||||
parsing time "8:41PM" as "Mon Jan _2 15:04:05 2006": ...
|
||||
9:35AM
|
||||
|
Loading…
x
Reference in New Issue
Block a user