Get Day, Month, and Year from Time in Go Language
The time
type also has Date()
method which returns the year, month and day of the time in single call.
All the methods you're looking for exist on the time.Time
type. You can just do;
year := fromDate.Year()
month := fromDate.Month()
day := fromDate.Day()
EDIT: I suppose it would be more concise to use time.Date like so;
year, month, day := fromDate.Date()