This is a creation in
Article, where the information may have evolved or changed.
When you compare time in go, you need to note the wording
package mainimport ( "FMT" "Time") Func main () { format := "2006-01-02 15:04:05" now : = time. Now () //now, _ := time. Parse (Format, time. Now (). Format) a, _ := time. Parse (format, "2015-03-10 11:00:00") b, _ := time. Parse (format, "2015-03-10 16:00:00") fmt. Println (now. Format (format), a.format (format), b.format (format)) fmt. Println (now. After (a)) fmt. Println (now. Before (a)) fmt. Println (now. After (b)) fmt. Println (now. Before (b)) fmt. Println (A.after (b)) fmt. Println (A.before (b)) fmt. Println (now. Format, a.format (formaT), b.format (Format)) fmt. Println (now. Unix (), a.unix (), b.unix ())}
The above wording, the comparison result is not correct, replaced by the annotation in the wording, the result is correct.
The reason is not very clear, does anyone know?