Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4. "fmt"
  5. "time"
  6. )
  7.  
  8. func main() {
  9. p := fmt.Println
  10.  
  11. t := time.Now()
  12. p(t.Format(time.RFC3339))
  13.  
  14. t1, e := time.Parse(time.RFC3339, "2012-11-01T22:08:41+00:00")
  15. p(t1)
  16.  
  17. p(t.Format("3:04PM"))
  18. p(t.Format("Mon Jan _2 15:04:05 2006"))
  19.  
  20. form := "3 04 PM"
  21. t2, e := time.Parse(form, "8 41 PM")
  22. p(t2)
  23.  
  24. p(e)
  25.  
  26. fmt.Printf("%d-%02d-%02dT%02d:%02d:%02d-00:00\n",
  27. t.Year(), t.Month(), t.Day(),
  28. t.Hour(), t.Minute(), t.Second(),
  29. )
  30.  
  31. ansic := "Mon Jan _2 15:04:05 2006"
  32. _, e = time.Parse(ansic, "8:41PM")
  33. p(e)
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement