Logo

Programming-Idioms

History of Idiom 61 > diff from v2 to v3

Edit summary for version 3 by :

Version 2

2015-04-14, 21:22:07

Version 3

2015-04-14, 21:23:34

Idiom #61 Get current date

Assign to variable d the current date/time value, in the most standard type.

Idiom #61 Get current date

Assign to variable d the current date/time value, in the most standard type.

Imports
import "time"
Imports
import "time"
Code
var d time.Time = time.Now()
Code
var d time.Time = time.Now()
Comments bubble
The type time.Time wraps a timestamp with nanosecond precision.
Comments bubble
The type Time wraps a timestamp with nanosecond precision.
Origin
http://golang.org/pkg/time/#Now
Origin
http://golang.org/pkg/time/#Now
Demo URL
https://play.golang.org/p/7BGpsxcbzf
Demo URL
https://play.golang.org/p/7BGpsxcbzf