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.
go-library/helper/time/time.go

29 lines
697 B

package time
import "time"
// GetCurrentDate 获取当前的时间 - 字符串
func GetCurrentDate() string {
return time.Now().Format("2006/01/02 15:04:05")
}
// GetCurrentUnix 获取当前的时间 - Unix时间戳
func GetCurrentUnix() int64 {
return time.Now().Unix()
}
// GetCurrentMilliUnix 获取当前的时间 - 毫秒级时间戳
func GetCurrentMilliUnix() int64 {
return time.Now().UnixNano() / 1000000
}
// GetCurrentNanoUnix 获取当前的时间 - 纳秒级时间戳
func GetCurrentNanoUnix() int64 {
return time.Now().UnixNano()
}
// GetCurrentWjDate 获取当前的时间 - 字符串 - 没有间隔
func GetCurrentWjDate() string {
return time.Now().Format("20060102")
}