]> Cypherpunks repositories - gostls13.git/commitdiff
time: add example for FixedZone
authorKevin Burke <kev@inburke.com>
Tue, 13 Feb 2018 17:06:59 +0000 (09:06 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 13 Feb 2018 21:57:23 +0000 (21:57 +0000)
Change-Id: I8a6c3e225038cbeb315433fabf8835f582836d3e
Reviewed-on: https://go-review.googlesource.com/93657
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/time/example_test.go

index 8c64506027ffed1bf7e5dc432aca2ec6f7bd7fa5..e64b0eced1cf3e35d54ac07dfee559c42f7bc2a4 100644 (file)
@@ -598,3 +598,10 @@ func ExampleTime_AppendFormat() {
        // Output:
        // Time: 11:00AM
 }
+
+func ExampleFixedZone() {
+       loc := time.FixedZone("UTC-8", -8*60*60)
+       t := time.Date(2009, time.November, 10, 23, 0, 0, 0, loc)
+       fmt.Println("The time is:", t.Format(time.RFC822))
+       // Output: The time is: 10 Nov 09 23:00 UTC-8
+}