当前位置:网站首页>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格式
}
边栏推荐
- Install cross compiler arm none liunx gnueabihf
- Scite change background color
- [global product discovery 2] the first pure cloud augmented reality (AR) platform - Israel
- Redis profile
- 数据库应用技术课程设计之商城管理系统
- Wechat native applet cloud development learning record 01
- About Wireshark's unsuccessful installation of npcap
- freetype库的移植
- Haproxy+kept cluster setup 02
- Use filechannel to copy files
猜你喜欢

Flex flexible box layout

How to establish rectangular coordinate system in space

CLion-Toolchains are not configured Configure Disable profile问题解决

C语言-入门-精华版-带你走进编程(一)

Xlua task list youyou
![[cocos creator] Click the button to switch the interface](/img/b8/f0fd54a2a197cbfd788990e2806b52.png)
[cocos creator] Click the button to switch the interface

I want to do large screen data visualization application feature analysis
![[step on the pit series] MySQL failed to modify the root password](/img/d0/f975baf18bac506208abff3713ac03.png)
[step on the pit series] MySQL failed to modify the root password

LwIP learning socket (application)

方正锐利重磅升级到12.0版本,包装印前处理更加便捷、高效!
随机推荐
Shader foundation 01
Wechat applet taro learning record
haproxy+keepalived集群搭建02
Huawei switch: configure Telnet, SSH and web access
idea取消引用顯示效果
数据的存储
Huawei switch basic configuration (telnet/ssh login)
What is definition? What is a statement? What is the difference between them?
方正锐利重磅升级到12.0版本,包装印前处理更加便捷、高效!
P2704 [NOI2001] 炮兵阵地(状压dp)
Wpf: solve the problem that materialdesign:dialoghost cannot be closed
Idea unreference Display Effect
oracle中的 (+)是什么意思
vcs import src < ros2. Repos failed
What does (+) in Oracle mean
Oracle queries grouped by time
Microsoft Security Response Center
[step on the pit series] MySQL failed to modify the root password
Pulitzer Prize in the field of information graphics - malofiej Award
一条通往服务器所有端口的隧道