Created
May 27, 2018 17:36
-
-
Save karl-gustav/04048436e3a45bec328a7abc521f676d to your computer and use it in GitHub Desktop.
Compare two datetimes in golang
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "time" | |
| ) | |
| func main() { | |
| const layout = "2006-01-02T15:04:05" | |
| time1 := time.Now() | |
| time2 := time.Now() | |
| if time1.Format(layout) == time2.Format(layout) { | |
| fmt.Println("The time values are equal") | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment