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 built-in package time contains the function Now, which provides the instance of a Time initialized to the current local time and date.

The Time type is an instant in time in nanoseconds. The zero value of Time is January 1, year 1, 00:00:00.000000000 UTC.

The pointer to the Time type should not be used. If only the value (not pointer to variable) is used, the Time instance is considered to be safe for use across multiple goroutines. The only exception is with serialization.

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