time.Time.Equal() Function in Golang With Examples Last Updated : 21 Apr, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report In Go language, time packages supplies functionality for determining as well as viewing time. The Time.Equal() function in Go language is used to check if the stated times "t" and "u" represents identical time instant or not. And two times located in different locations can even be equal. Moreover, this function is defined under the time package. Here, you need to import the "time" package in order to use these functions. Syntax: func (t Time) Equal(u Time) bool Here, "t" and "u" are the stated time. Return Value: It returns true if the stated times are equal else it returns false. Example 1: C // Golang program to illustrate the usage of // Time.Equal() function // Including main package package main // Importing fmt and time import "fmt" import "time" // Calling main func main() { // Defining t and u parameter of Equal method t := time.Date(2020, 3, 2, 12, 14, 0, 0, time.UTC) u := time.Date(2020, 3, 1, 36, 14, 0, 0, time.UTC) // Calling Equal method TimesequalOrnot := t.Equal(u) // Prints output fmt.Printf("%v\n", TimesequalOrnot) } Output: true Example 2: C // Golang program to illustrate the usage of // Time.Equal() function // Including main package package main // Importing fmt and time import "fmt" import "time" // Calling main func main() { // Defining t and u parameter // of Equal method t := time.Date(2020, 3, 2, 12, 14, 07, 0, time.UTC) u := time.Date(2020, 3, 1, 36, 14, 0, 0, time.UTC) // Calling Equal method TimesequalOrnot := t.Equal(u) // Prints output fmt.Printf("%v\n", TimesequalOrnot) } Output: false Comment More infoAdvertise with us Next Article time.Time.After() Function in Golang With Examples N nidhi1352singh Follow Improve Article Tags : Go Language GoLang-time Similar Reads time.Time.Add() Function in Golang with Examples In Go language, time packages supplies functionality for determining as well as viewing time. The Time.Add() function in Go language is used to add the stated time and duration. Moreover, this function is defined under the time package. Here, you need to import the "time" package in order to use the 2 min read time.Time.Day() Function in Golang With Examples In Go language, time packages supplies functionality for determining as well as viewing time. The Time.Day() function in Go language is used to check the day of the month in which the stated "t" presents itself. Moreover, this function is defined under the time package. Here, you need to import the 2 min read time.Time.Date() Function in Golang with Examples In Go language, time packages supplies functionality for determining as well as viewing time. The Time.Date() function in Go language is used to check the year, month, and day in which the stated "t" presents itself. Moreover, this function is defined under the time package. Here, you need to import 2 min read time.Time.Clock() Function in Golang With Examples In Go language, time packages supplies functionality for determining as well as viewing time. The Time.Clock() function in Go language is used to check the hour, minute, and second within the day in which the stated "t" presents itself. Moreover, this function is defined under the time package. Here 2 min read time.Time.After() Function in Golang With Examples In Go language, time packages supplies functionality for determining as well as viewing time. The Time.After() function in Go language is used to check if the stated time instant t is after the stated u or not. Moreover, this function is defined under the time package. Here, you need to import the " 2 min read time.Time.Before() Function in Golang With Examples In Go language, time packages supplies functionality for determining as well as viewing time. The Time.Before() function in Go language is used to check if the stated time instant t is before the stated u or not. Moreover, this function is defined under the time package. Here, you need to import the 2 min read Like