What is the `zero` value for time.Time in Go

In Golang, the zero value for the time.Time type is zero time, which represents the time instant “January 1, year 1, 00:00:00 UTC”.

To create a zero time value, declare a variable of type time.Time without initializing it.

package main

import (

func main() {
  var zeroTime time.Time
  fmt.Println("Zero time:", zeroTime)


Zero time: 0001-01-01 00:00:00 +0000 UTC

That’s it.

Leave a Comment