hic003cih / Golang

0 stars 0 forks source link

package time #45

Open hic003cih opened 4 years ago

hic003cih commented 4 years ago

將字串轉換成時間 t, _ := time.Parse("2006-01-02", "2011-04-25") 輸出 2011-04-25 00:00:00 +0000 UTC

日期加上時間,沒有乘上秒或分或小時,就只加1豪秒 t = t.Add(time.Duration(1000000000)) 輸出 2011-04-25 00:00:01 +0000 UTC

Duration乘上second t = t.Add(time.Second * time.Duration(1000000000)) 輸出 2043-01-01 01:46:40 +0000 UTC

hic003cih commented 4 years ago

https://gobyexample.com/time https://golangbyexample.com/parse-time-in-golang/ https://yourbasic.org/golang/format-parse-string-time-date-example/ https://www.dotnetperls.com/time-go https://stackoverflow.com/questions/46369920/convert-string-date-to-time-time-in-golang