diff options
author | Radek Sohlich <sohlich@gmail.com> | 2017-11-03 20:36:12 +0100 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2017-11-06 17:57:52 +0000 |
commit | e49d074c3449736d283354957d7e5f55a465e67b (patch) | |
tree | 53184d891989d1732c35ccf76c80d1f22e8deee2 /src/time/example_test.go | |
parent | 37b15baa3b884d5de8563f91be2afa3659e8258f (diff) | |
download | go-e49d074c3449736d283354957d7e5f55a465e67b.tar.gz go-e49d074c3449736d283354957d7e5f55a465e67b.zip |
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 <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/time/example_test.go')
-rw-r--r-- | src/time/example_test.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/time/example_test.go b/src/time/example_test.go index 1507f3f175..bab129db3c 100644 --- a/src/time/example_test.go +++ b/src/time/example_test.go @@ -569,3 +569,14 @@ func ExampleTime_Sub() { // Output: // difference = 12h0m0s } + +func ExampleTime_AppendFormat() { + t := time.Date(2017, time.November, 4, 11, 0, 0, 0, time.UTC) + text := []byte("Time: ") + + text = t.AppendFormat(text, time.Kitchen) + fmt.Println(string(text)) + + // Output: + // Time: 11:00AM +} |