Created
April 12, 2014 10:55
-
-
Save 1000copy/10529863 to your computer and use it in GitHub Desktop.
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
| import ( | |
| "time" | |
| ) | |
| // 时间格式化字符串(奇葩的设置) | |
| const TimeFormat = "2006-01-02 15:04:05" | |
| const TimeFormat1 = "2006-01-02" | |
| func TestXYZ(t *testing.T) { | |
| r1,_:=time.Parse(TimeFormat1,"2014-04-11") | |
| r2,_:=time.Parse(TimeFormat1,"2014-04-12")\ | |
| // 取得当年日期和时间 | |
| r4 :=time.Now() | |
| // 判断时间的前后关系 | |
| r := r1.Before(r2) | |
| t.Error(r) | |
| t.Error(r4) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment