当前位置:网站首页>Go language time Format pit
Go language time Format pit
2022-06-09 12:24:00 【. fried eggs with tomatoes】
Problem description
Format The time of future output is the same as now It's different
package main
import (
"fmt"
"time"
)
func main() {
now := time.Now()
fmt.Println(now)
format := now.Format("2006-01-01 15:04:05")
fmt.Println(format)
}

terms of settlement
package main
import (
"fmt"
"time"
)
func main() {
now := time.Now()
fmt.Println(now)
format := now.Format("2006-01-02 15:04:05")
fmt.Println(format)
}

Use time.Format Format time parameter layout It has to be transmitted "2006-01-02 15:04:05", Why? ? No why? , This is the worst place , It is said that this date is GO The birth time of language , This time must be passed when formatting , There will be problems in other times .
边栏推荐
- 06 | the first step of China Taiwan landing: enterprise strategy decomposition and current situation research (Discovery)
- ConfigurationManager姿势快闪
- 07 | the second step of the mid platform landing: enterprise digital panoramic planning (define)
- curator - 实现服务注册与发现
- Tag backtracking - brush questions to prepare knowledge -1 Backtracking template, + lt.46 Full Permutation
- 3.<tag-回溯和组合及其剪枝>lt.17. 电话号码的字母组合
- 12.<tag-二叉树和BST基础>lt.701. 二叉搜索树中的插入操作 dbc
- 给 Web3 项目的智能合约安全指南
- Calculate the result of a string formula
- Range method returns the object conversion method
猜你喜欢

What are the deadlock troubleshooting tools?

6.两两交换链表中的节点

06 | the first step of China Taiwan landing: enterprise strategy decomposition and current situation research (Discovery)

5.<tag-回溯和切割问题>lt.93.复原IP地址

柴云鹏:创新能力的培养至关重要|OceanBase 数据库大赛访谈

Excel | App_ Error in workbookactive cannot set the installed property of class addin

软件项目管理考点整理(Software Project Management)

13. Using WPF to develop USB detection tool

13. < tag binary tree and BST foundation > lt.450 Delete node DBC in binary search tree
![[reprint] what is the](/img/7a/de7df9830f589be0b2214f875eb95e.png)
[reprint] what is the "brain crack" of distributed systems?
随机推荐
使用U盘一比一拷贝核心板系统镜像的方法
你不得不懂的mysql隔离级别底层
curator - 节点类型
Endnote | 如何快速分享文献给别人(包含题录+备注+pdf文件)| endnote保存备份
Anonymous inner classes and local variables
MySQL SQL statement optimization
内核中_init,_exit中的作用
投资理财产品会把本金都亏了吗?
IPv6 address assignment
Gson, fastjason, Jackson serialization differences
Origin: unable to import data, solution to sticking data
[reprint] understand G1 garbage collector
Range方法返回对象转换办法
【管理知多少】中文“其他”、英文“OTHER”、日文“その他”.......
Software project management
5.括号生成
How to insert the video monitoring memory card into the Yuntai pro of Xiaomi smart camera
【堆排|快排】Top-k问题
From these papers in 2022, we can see the trend of recommended system sequence modeling
Please talk about optimistic lock, pessimistic lock and applicable scenarios