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.
22 lines
411 B
22 lines
411 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 ParseInLocation(str string) time.Time { |
|
//str := "2020-10-12 14:19:53" |
|
|
|
tmp := "2006-01-02 15:04:05" |
|
|
|
t, _ := time.ParseInLocation(tmp, str, time.Local) |
|
return t |
|
}
|
|
|