摘要: package mainimport ( "fmt" "reflect" "time")func main() { //格式化字符串为时间 test, _ := time.Parse("2006-01-02", "2013-11-11") //时间增加 after, _ := time.ParseDuration("15m") fmt.Println(test) test = test.Add(after) fmt.Println(test) //格式化时间为字符串 t3 : 阅读全文
posted @ 2014-01-26 15:59 forrestsun 阅读(4232) 评论(0) 推荐(0) 编辑
摘要: package mainimport ( "fmt" "time")func main() { test, err := time.Parse("2006-01-02", "2013-01-12") if err != nil { panic(err) } fmt.Println(test)}[ `run` | done: 4.533945ms ]2013-01-12 00:00:00 +0000 UTC其中time.parse格式改变后,未发生变化test, err := time.Parse("200 阅读全文
posted @ 2014-01-26 08:59 forrestsun 阅读(326) 评论(0) 推荐(0) 编辑