当前位置:网站首页>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格式
}
边栏推荐
- PostGIS space function
- String class
- Technology dry goods | Roberta of the migration of mindspore NLP model - emotion analysis task
- MAE
- Compilation error: "not in executable format: file format not recognized"“
- P1896 [SCOI2005] 互不侵犯(状压dp)
- oracle 插入单引号
- P1896 [scoi2005] non aggression (shape pressure DP)
- Mutual call between Lua and C #
- Technical dry goods | thinking about the unification of dynamic and static diagrams of AI framework
猜你喜欢
freetype库的移植
数据库应用技术课程设计之商城管理系统
How to configure GDAL under idea
Getting started with minicom
About Wireshark's unsuccessful installation of npcap
Flex flexible box layout
Lua framwrok framework starts
[step on the pit series] MySQL failed to modify the root password
Transplantation of freetype Library
Ventuz Foundation Series "one step at the door"
随机推荐
CLion-Toolchains are not configured Configure Disable profile问题解决
链式长取值
Uniapp learning records
Xlua task list youyou
Lua hot update basic grammar
Idea unreference Display Effect
L'installateur a été installé avec une erreur inattendue
Are you still watching the weather forecast on TV?
Transfinite hacker cognition
Lua framwrok framework starts
Transplantation of freetype Library
[usaco12mar]cows in a skyscraper g (state compression DP)
PHP wechat red packet grabbing algorithm
String class
How does yarn link help developers debug NPM packages?
regular expression
Usage of (case, when) in PostgreSQL
Classes and objects
My touch screen production "brief history" 1
YOLO系列 --- xml2txt脚本