Update 04.8.md (#748)

* Update 04.8.md

更改04.8内容,Duration d 更改为 d Duration  以及添加  2006-01-02 15:04:05

* Update 04.8.md
This commit is contained in:
xiaofsu
2019-12-25 10:28:01 +08:00
committed by Unknwon
parent 173fcc518c
commit 10b5050492

View File

@@ -45,6 +45,7 @@ func main() {
// formatting times: // formatting times:
fmt.Println(t.Format(time.RFC822)) // 21 Dec 11 0852 UTC fmt.Println(t.Format(time.RFC822)) // 21 Dec 11 0852 UTC
fmt.Println(t.Format(time.ANSIC)) // Wed Dec 21 08:56:34 2011 fmt.Println(t.Format(time.ANSIC)) // Wed Dec 21 08:56:34 2011
// The time must be 2006-01-02 15:04:05
fmt.Println(t.Format("02 Jan 2006 15:04")) // 21 Dec 2011 08:52 fmt.Println(t.Format("02 Jan 2006 15:04")) // 21 Dec 2011 08:52
s := t.Format("20060102") s := t.Format("20060102")
fmt.Println(t, "=>", s) fmt.Println(t, "=>", s)
@@ -54,7 +55,7 @@ func main() {
输出的结果已经写在每行 `//` 的后面。 输出的结果已经写在每行 `//` 的后面。
如果你需要在应用程序在经过一定时间或周期执行某项任务(事件处理的特例),则可以使用 `time.After` 或者 `time.Ticker`:我们将会在第 14.5 节讨论这些有趣的事情。 另外,`time.SleepDuration d` 可以实现对某个进程(实质上是 goroutine时长为 d 的暂停。 如果你需要在应用程序在经过一定时间或周期执行某项任务(事件处理的特例),则可以使用 `time.After` 或者 `time.Ticker`:我们将会在第 14.5 节讨论这些有趣的事情。 另外,`time.Sleepd Duration` 可以实现对某个进程(实质上是 goroutine时长为 d 的暂停。
## 链接 ## 链接