Fetch the repository succeeded.
package extime
import (
"fmt"
"log"
"time"
)
var IsLog bool
func Tominute() int64 {
t := time.Now()
newTime := time.Date(t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), 0, 0, t.Location())
if IsLog {
log.Printf("moyu/extime.Today() today=%d", newTime.Unix())
}
return newTime.Unix()
}
func Tohour() int64 {
t := time.Now()
newTime := time.Date(t.Year(), t.Month(), t.Day(), t.Hour(), 0, 0, 0, t.Location())
if IsLog {
log.Printf("moyu/extime.Today() today=%d", newTime.Unix())
}
return newTime.Unix()
}
func Today() int64 {
t := time.Now()
newTime := time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location())
if IsLog {
log.Printf("moyu/extime.Today() today=%d", newTime.Unix())
}
return newTime.Unix()
}
func Tomonth() int64 {
t := time.Now()
newTime := time.Date(t.Year(), t.Month(), 0, 0, 0, 0, 0, t.Location())
if IsLog {
log.Printf("moyu/extime.Today() today=%d", newTime.Unix())
}
return newTime.Unix()
}
func Toyear() int64 {
t := time.Now()
newTime := time.Date(t.Year(), 0, 0, 0, 0, 0, 0, t.Location())
if IsLog {
log.Printf("moyu/extime.ToYear() today=%d", newTime.Unix())
}
return newTime.Unix()
}
//格式化
func ToDate() string {
return ToDatef("-")
}
func ToDatef(cut string) string {
now := time.Now()
return fmt.Sprintf("%d%s%d%s%d", now.Year(), cut, now.Month(), cut, now.Day())
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。