ticker := time.NewTicker(time.Second) for range ticker.C { // do something every second }
time.Sleep(2 * time.Second)
t := time.Now() fmt.Println(t.Format("15:04:05"))In this example, we use `time.Now` to get the current time, and then use `time.Time`'s `Format` method to format the time as `HH:MM:SS`, where `SS` represents seconds. The `time` package is part of the Go standard library.