I’m working on a program which reads from a log file and groups certain events by hour. I’ve hit a snag while rounding the hours of the first and last entries in the log.
So basically for better presentation I’m rounding the first entry down, and rounding the hour of the last entry up.
I checked around and saw a solution posted by Rob for rounding the hour for a given time.Time type down:
fmt.Println(time.LocalTime().Format("1/2/2006 15:00"))
I have couple of questions regarding this, is there a similar way to round the hour of a given date up?
Also the documentation for the time package mentions a predefined layout for formatting and parsing time
Mon Jan 2 15:04:05 MST 2006
Then why does the format posted by Rob work?
Any help is appreciated.