Golang time.Time.Day() function is “used to check the day of the month in which the stated ‘t’ presents itself.”
Syntax
func (t Time) Day() int
Parameters
t: It is the stated time.
Return Value
The Day() function returns the day of the month in which the stated ‘t’ occurs.
Example 1: How to Use time.Time.Day() function
package main
import (
"fmt"
"time"
)
func main() {
// Get the current time
date := time.Date(2025, 12, 25, 0, 0, 0, 0, time.UTC)
// Get the current day of the month
day := date.Day()
fmt.Println("Current Day:", day)
}
Output
Current Day: 25
Example 2: How to Get Current Day in Golang
To get the current day in Golang, you can use the “time.Time.Day()” function.
package main
import (
"fmt"
"time"
)
func main() {
// Get the current time
now := time.Now()
// Get the current day of the month
day := now.Day()
fmt.Println("Current Day:", day)
}
Output
Current Day: 1
That’s it.

Krunal Lathiya is a seasoned Computer Science expert with over eight years in the tech industry. He boasts deep knowledge in Data Science and Machine Learning. Versed in Python, JavaScript, PHP, R, and Golang. Skilled in frameworks like Angular and React and platforms such as Node.js. His expertise spans both front-end and back-end development. His proficiency in the Python language stands as a testament to his versatility and commitment to the craft.