Skip to content

Commit e49d074

Browse files
sohlichianlancetaylor
authored andcommitted
time: example in doc for time.AppendFormat func
The simple example would contribute to better understanding what function does. Change-Id: I36a2952df8b0e1762ec0cd908a867c457f39366e Reviewed-on: https://go-review.googlesource.com/75970 Reviewed-by: Brad Fitzpatrick <[email protected]> Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 37b15ba commit e49d074

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/time/example_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,3 +569,14 @@ func ExampleTime_Sub() {
569569
// Output:
570570
// difference = 12h0m0s
571571
}
572+
573+
func ExampleTime_AppendFormat() {
574+
t := time.Date(2017, time.November, 4, 11, 0, 0, 0, time.UTC)
575+
text := []byte("Time: ")
576+
577+
text = t.AppendFormat(text, time.Kitchen)
578+
fmt.Println(string(text))
579+
580+
// Output:
581+
// Time: 11:00AM
582+
}

0 commit comments

Comments
 (0)