Standard library / time

time.Time.Nanosecond()

Return the nanosecond offset within the second, from 0 to 999999999. Expected stdout: '123000000\n'.

Formal Syntax & Structure

go syntaxgo
func (t Time) Nanosecond() int

Return Value

int

Return the nanosecond offset within the second, from 0 to 999999999.

Working Example

Example Snippetgo
package main
import (  "fmt"  "time")
func fixed() time.Time { return time.Date(2024, 2, 29, 12, 34, 56, 123000000, time.UTC) }func main()            { fmt.Println(fixed().Nanosecond()) }
Go Reference