update example of gtime
@@ -2,6 +2,7 @@ package main
import (
"fmt"
+ "github.com/gogf/gf/g/os/glog"
"github.com/gogf/gf/g/os/gtime"
"time"
)
@@ -19,15 +20,11 @@ func main() {
"2018-02-09",
"2017/12/14 04:51:34 +0805 LMT",
"2018/02/09 12:00:15",
- "18/02/09 12:16",
- "18/02/09 12",
- "18/02/09 +0805 LMT",
"01/Nov/2018:13:28:13 +0800",
"01-Nov-2018 11:50:28 +0805 LMT",
"01-Nov-2018T15:04:05Z07:00",
"01-Nov-2018T01:19:15+08:00",
"01-Nov-2018 11:50:28 +0805 LMT",
- "01/Nov/18 11:50:28",
"01/Nov/2018 11:50:28",
"01/Nov/2018:11:50:28",
"01.Nov.2018:11:50:28",
@@ -35,12 +32,12 @@ func main() {
}
cstLocal, _ := time.LoadLocation("Asia/Shanghai")
for _, s := range array {
- fmt.Println(s)
if t, err := gtime.StrToTime(s); err == nil {
- fmt.Println(t.String())
+ fmt.Println(s)
+ fmt.Println(t.UTC().String())
fmt.Println(t.In(cstLocal).String())
} else {
- panic(err)
+ glog.Error(s, err)
}
fmt.Println()
}
