@kjk1/

gobook time parse

Go

No description

fork
loading
Files
  • main.go

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.46968857242662976","path":"main.go","file":{"path":"main.go","content":{"asEncoding":{"base64":"cGFja2FnZSBtYWluCgppbXBvcnQgKAoJImZtdCIKCSJsb2ciCgkidGltZSIKKQoKZnVuYyBtYWluKCkgewoJLy8gOnNob3cgc3RhcnQKCXMgOj0gIjIwMTctMDQtMDkgMDM6Mzg6NDUuMDAwIFVUQyIKCXQsIGVyciA6PSB0aW1lLlBhcnNlKCIyMDA2LTAyLTAxIDE1OjA0OjA1LjAwMCBNU1QiLCBzKQoJaWYgZXJyICE9IG5pbCB7CgkJbG9nLkZhdGFsZigidGltZS5QYXJzZSgpIGZhaWxlZCB3aWh0ICclcydcbiIsIGVycikKCX0KCWZtdC5QcmludGYoInllYXI6ICVkLCBtb250aDogJWQsIGRheTogJWRcbiIsIHQuWWVhcigpLCB0Lk1vbnRoKCksIHQuRGF5KCkpCgkvLyA6c2hvdyBlbmQKfQ=="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package main

import (
	"fmt"
	"log"
	"time"
)

func main() {
	// :show start
	s := "2017-04-09 03:38:45.000 UTC"
	t, err := time.Parse("2006-02-01 15:04:05.000 MST", s)
	if err != nil {
		log.Fatalf("time.Parse() failed wiht '%s'\n", err)
	}
	fmt.Printf("year: %d, month: %d, day: %d\n", t.Year(), t.Month(), t.Day())
	// :show end
}