Examples using... time.Now()
YearDay returns the day of the year specified by t, in the range [1,365] for non-leap years, and [1,366] in leap years.
Nanosecond returns the nanosecond offset within the second specified by t, in the range [0, 999999999].
Second returns the second offset within the minute specified by t, in the range [0, 59].
Minute returns the minute offset within the hour specified by t, in the range [0, 59].
Hour returns the hour within the day specified by t, in the range [0, 23].
A Month specifies a month of the year (January = 1, ...).
A Duration represents the elapsed time between two instants as an int64 nanosecond count. The representation limits the largest representable duration to approximately 290 years.
This example passes a context with an arbitrary deadline to tell a blocking function that it should abandon its work as soon as it gets to it.
Go’s math/rand package provides pseudorandom number generation.
A common requirement in programs is getting the number of seconds, milliseconds, or nanoseconds since the Unix epoch. Here’s how to do it in Go.
Rate limiting is an important mechanism for controlling resource utilization and maintaining quality of service. Go elegantly supports rate limiting with goroutines, channels, and tickers.
case blocks in go automatically break after their branch is executed and the user must use the "fallthrough" keyword to have it continue to match other case blocks.