星期三, 2019-04-10 | Author: LeeheadportraitAuthor: Lee Name: lee
Email: service@i5a6.com
Site: https://www.pomelolee.com/
About: webgame网页,手机游戏服务端架构和开发者 | golang | 10,653 views

使用golang的time函数,记得要设定系统的时区,否则数据有问题

设置centos系统时区为上海

timedatectl set-timezone Asia/Shanghai
import("fmt"
	"time")
func main(){
	t := time.Now()
	zero_tm := time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location()).Unix()
	fmt.Println(zero_tm)
}
~谢谢打赏~

Tags: golang