Standard library / time

time.Time.Day()

Return the day of the month (1–31) in the associated location. Expected stdout: '29\n'.

Formal Syntax & Structure

go syntaxgo
func (t Time) Day() int

Return Value

int

Return the day of the month (1–31) in the associated location.

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().Day()) }
Go Reference