You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
412 B
21 lines
412 B
package util |
|
|
|
import "time" |
|
|
|
// GetNowYmdHms 获取当前datetime |
|
func GetNowYmdHms() string { |
|
return time.Now().Format("2006-01-02 15:04:05") |
|
} |
|
|
|
// GetNowUnix 获取当前时间戳 |
|
func GetNowUnix() int64 { |
|
return time.Now().Unix() |
|
} |
|
|
|
func TraYmdHms(t time.Time) string { |
|
return t.Format("2006-01-02 15:04:05") |
|
} |
|
|
|
func TimeTranYmdHms(t int64) string { |
|
return time.Unix(t, 0).Format("2006-01-02 15:04:05") |
|
}
|
|
|