Golang中进行时间比较
package main
import (
"fmt"
"time"
)
func main() {
now := time.Now()
timeDur := time.Duration(10)*time.Second + time.Duration(1)*time.Minute
nowAddTime := now.Add(timeDur)
//时间比较
//时间之前比较
fmt.Println(nowAddTime.After(now)) //true
//时间之后比较
fmt.Println(nowAddTime.Before(now)) //false
//时间相等比较
fmt.Println(now.Equal(now)) //true
}