- refactor timestr.
This commit is contained in:
@@ -146,19 +146,25 @@ func GetUUID() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetCurTimeStr() 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 {
|
func GetCurTimestamp() int64 {
|
||||||
return time.Now().Unix()
|
return time.Now().Unix()
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetAPIOperator() string {
|
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 {
|
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) {
|
func HTTPResponse2Json(response *http.Response) (map[string]interface{}, error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user