diff --git a/string_test.go b/string_test.go index 1d33ced..0395baf 100755 --- a/string_test.go +++ b/string_test.go @@ -1,6 +1,7 @@ package helper import ( + "fmt" "testing" ) diff --git a/time.go b/time.go index d14b246..ae84828 100755 --- a/time.go +++ b/time.go @@ -19,3 +19,14 @@ func FormatDate(str string) string { } return time.Unix(date, 0).Format("2006-01-02") } + +//获取当天开始时间戳 +func GetTodayStartTimeStamp() int64{ + + var reserveTime time.Time + loc, _ := time.LoadLocation("Asia/Shanghai") + + date := time.Now().Format("2006-01-02") + reserveTime,_ = time.ParseInLocation("2006-01-02",date,loc) + return reserveTime.Unix() +} diff --git a/time_test.go b/time_test.go index 96a4b63..e2bab21 100755 --- a/time_test.go +++ b/time_test.go @@ -15,3 +15,7 @@ func Test_FormatDate(t *testing.T) { t.Log(ret.Unix()) t.Log(err) } + +func Test_GetToadyStartTimeStamp(t *testing.T){ + t.Log(GetTodayStartTimeStamp()) +} \ No newline at end of file