I am learning how to code in Go and trying to create a simple reminder function.
I want to display the current time as a regular 24 hour clock, XX.XX (hours, minutes).
I have saved the current time in a variable t and when I print it I find out that the time is 23.00 early November 2009. Fine, but when I print t.Hour and t.Minute the result is 132288.132480
.
It is something similar when I print t.Seconds
. I have not been able to figure out why this happens.
Roughly 2000 days have passed since but that is only 48k hours and 2880k minutes so the small difference between the hours and minutes in my result hints that the issue is something else.
I am running the code in the go playground.
My code:
package main
import (
"fmt"
"time"
)
func main() {
Remind("It's time to eat")
}
func Remind(text string) {
t := time.Now()
fmt.Println(t)
fmt.Printf("The time is %d.%d: ", t.Hour, t.Minute)
fmt.Printf(text)
fmt.Println()
}