The time Package
time has Duration, Now, Since and formatting with a reference layout.
Example
package main
import (
"fmt"
"time"
)
func main() {
d := 90 * time.Minute
fmt.Println(d, d.Hours())
t := time.Date(2026, 3, 15, 10, 30, 0, 0, time.UTC)
fmt.Println(t.Format("2006-01-02 15:04"), t.Weekday())
}Result
1h30m0s 1.5 2026-03-15 10:30 Sunday
Exercise
Reference layout year.
Format("-01-02")
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.