golang 获取当前日期,月份第一天和最后一天
发布时间:2020-12-16 18:19:37 所属栏目:大数据 来源:网络整理
导读: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(la
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) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |