当前位置:网站首页>Golang 时间格式整理
Golang 时间格式整理
2022-07-03 08:04:00 【Bel_Ami同学】
// 时间格式整理
func toTime(jcrq string) string {
loc, _ := time.LoadLocation("Asia/Shanghai") //设置时区
tt, _ := time.ParseInLocation("2006-01-02 15:04:05", jcrq, loc) // 将时间字符串格式化为golang的"time.Time"对象
tm := time.Unix(tt.Unix(), 0)
return tm.Format("2006-01-02") // 返回Y-m-d格式
}
边栏推荐
猜你喜欢
Redis batch startup and shutdown script
haproxy+keepalived集群搭建02
How to establish rectangular coordinate system in space
vcs import src < ros2. Repos failed
Transplantation of freetype Library
Unity XR realizes interaction (grasping, moving, rotating, transmitting, shooting) -pico
Lua framwrok framework starts
Getting started with minicom
Flex flexible box layout
unity2019_ Input management
随机推荐
freetype库的移植
L'installateur a été installé avec une erreur inattendue
一个实习生的CnosDB之旅
Haproxy+kept cluster setup 02
Huawei s5700 switch initialization and configuration SSH and telnet remote login methods
P1896 [scoi2005] non aggression (shape pressure DP)
Yolo series --- xml2txt script
WPF:解决MaterialDesign:DialogHost 无法关闭问题
vcs import src < ros2. Repos failed
P1896 [SCOI2005] 互不侵犯(状压dp)
Wechat native applet cloud development learning record 01
LwIP learning socket (application)
Compilation error: "not in executable format: file format not recognized"“
PHP wechat red packet grabbing algorithm
Technical dry goods | some thoughts on the future of AI architecture
璞华PLM为全场景产品生命周期管理赋能,助力产品主线的企业数字化转型
Transplantation of freetype Library
Quality blog——
Multi traveling salesman problem -- overview of formula and solution process
创业团队如何落地敏捷测试,提升质量效能?丨声网开发者创业讲堂 Vol.03