内容概述

now := time.Now() currentYear, currentMonth, _ := now.Date() currentLocation := now.Location() firstOfMonth := time.Date(currentYear, currentMonth, 1, 0, 0, 0, 0, currentLocation) las

语音解读

图文解释

Now := time.Now()
    currentYear,currentMonth,_ := Now.Date()
    currentLocation := Now.Location()

    firstOfMonth := time.Date(currentYear,1,currentLocation)
    lastOfMonth := firstOfMonth.AddDate(0,-1)

    fmt.Println(firstOfMonth.Unix())
    fmt.Println(lastOfMonth.Unix())
    
    layout := "2006-01-02 15:04:05"
    loc,_:= time.LoadLocation("Asia/Chongqing")
    zero_day,_ := time.ParseInLocation(layout,"1949-10-01 00:00:00",loc)

总结

如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给好友。