1 Star 0 Fork 0

RocSun/calendar

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
date.go 429 Bytes
一键复制 编辑 原始数据 按行查看 历史
unknown 提交于 2022-06-08 17:07 +08:00 . 放假调班信息已解析。待完善接口。
package utils
import (
"fmt"
"strings"
)
// ModifyDateFormat 修改日期格式字符串,使符合YY(YY)-MM-DD hh:mm:ss,支持的参数格式YYYY-MM-DD hh:mm:ss
func ModifyDateFormat(t string) string {
if t == "" {
return ""
}
res := strings.Split(t, "-")
if len(res[1]) < 2 {
res[1] = fmt.Sprintf("0%s", res[1])
}
if len(res[2]) < 2 {
res[2] = fmt.Sprintf("0%s", res[2])
}
return strings.Join(res, "-")
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/RocsSun/calendar.git
git@gitee.com:RocsSun/calendar.git
RocsSun
calendar
calendar
fbb13755b435

搜索帮助