Get Hour Offset within Day in Go

Posted by yhuang
Public (Editable by Users)

Hour returns the hour within the day specified by t, in the range [0, 23].

Go
Edit
package main

import (
	"fmt"
	"time"
)

func main() {

	now := time.Now()
	fmt.Println(now.Hour())
}