O'Reilly logo

Go Standard Library Cookbook by Radomir Sohlich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works...

The Time type provides the In method which consumes the pointer to time.Location. The returned Time is the original one converted to the given time zone. Note that the Time instance is considered to be immutable, so the methods changing the instance result in a new Time instance.

The time package refers to the IANA Time Zone database as a source of locations. The LoadLocation function looks for the directory or ZIP file from the ZONEINFO environment variable. If not found, the known installation locations on UNIX systems are searched. Finally, it looks in $GOROOT/lib/time/zoneinfo.zip.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required