- refactor timestr.

This commit is contained in:
gazebo
2018-06-26 18:40:37 +08:00
parent ee4e88594d
commit e0ceb0ad0a

View File

@@ -146,19 +146,25 @@ func GetUUID() string {
}
func GetCurTimeStr() string {
return time.Now().Format("2006-01-02 15:04:05")
return Time2Str(time.Now())
}
// timestamp is in second
func GetCurTimestamp() int64 {
return time.Now().Unix()
}
func GetAPIOperator() string {
return time.Now().Format("2006-01-02_15:04:05")
return Time2Str(time.Now())
}
// timestamp is in second
func Timestamp2Str(timestamp int64) string {
return time.Unix(timestamp/1000, 0).Format("2006-01-02 15:04:05")
return Time2Str(time.Unix(timestamp, 0))
}
func Time2Str(t time.Time) string {
return t.Format("2006-01-02 15:04:05")
}
func HTTPResponse2Json(response *http.Response) (map[string]interface{}, error) {