当前位置:网站首页>The difference of time zone and the time library of go language
The difference of time zone and the time library of go language
2022-07-05 23:52:00 【I'm PY】
UTC,GMT,CST What is it? ?
- You can refer to this article :https://baijiahao.baidu.com/s?id=1732139602203523267
- UTC Time is slower than the time zone indicated by Shanghai, China 8 Hours .
- CST: 2022-08-22 00:00:00 +0800 CST
- UTC: 2022-08-21 16:00:00 +0000 UTC
Go In language time Some common methods of Library
time.Local (*time.Location): Get the time zone of the current system
time.UTC (*time.Location): UTC
func time.Parse(layout string, value string) (time.Time, error)- You can convert a string to go Time type . first layout Is the corresponding time template . time Many templates are built in the Library . You can customize FormatTimeShort = “2006-01-02”, The template can only be parsed to date .
- The default conversion time of this method is UTC Time .

func time.ParseInLocation(layout string, value string, loc *time.Location) (time.Time, error)- This method can pass time zone information when parsing .
func time.Now() time.Timereturn Current time zone Time for .func (time.Time).UTC() time.TimeTime that will have a time zone , Turn into UTC Time represented .func (time.Time).Unix() int64This method will Time Type of time converted to Time stamp , Timestamp is time independent . The default is UTC The start of the specified time .func time.Unix(sec int64, nsec int64) time.TimeThis function can convert the timestamp into Current time zone Of Time Type time .func (time.Time).MarshalJSON() ([]byte, error)It's time to analyze json Function of format .
Be careful :
- When using time , Pay attention to the conversion of time zones .
- Generally, when reading the local time zone , Pay attention to the setting of the local time zone :
- such as ubuntu System , Input
dateInstructions , You can get the current time . timedatectl set-timezone Asia/ShanghaiSet the current time zone to Time zone in Shanghai, China .
- such as ubuntu System , Input
边栏推荐
- How to improve eloquence
- C# 反射与Type
- XML configuration file (DTD detailed explanation)
- 保研笔记四 软件工程与计算卷二(8-12章)
- CloudCompare&PCL 点云随机添加噪声
- Latex multiple linebreaks
- Learn PWN from CTF wiki - ret2libc1
- Rasa 3. X learning series -rasa 3.2.1 new release
- 【luogu CF487E】Tourists(圆方树)(树链剖分)(线段树)
- 【luogu P3295】萌萌哒(并查集)(倍增)
猜你喜欢

QT QPushButton details

STM32__06—单通道ADC

云呐|固定资产管理系统主要操作流程有哪些

Initialize your vector & initializer with a list_ List introduction

Breadth first search open turntable lock

STM32__ 06 - single channel ADC

【在线聊天】原来微信小程序也能回复Facebook主页消息!

Fiddler Everywhere 3.2.1 Crack

After summarizing more than 800 kubectl aliases, I'm no longer afraid that I can't remember commands!

妙才周刊 - 8
随机推荐
妙才周刊 - 8
698. Divided into k equal subsets ●●
Fiddler Everywhere 3.2.1 Crack
Cwaitabletimer timer, used to create timer object access
PV静态创建和动态创建
C file and folder operation
【EF Core】EF Core与C# 数据类型映射关系
XML配置文件(DTD详细讲解)
ts类型声明declare
[Luogu cf487e] tours (square tree) (tree chain dissection) (line segment tree)
总结了 800多个 Kubectl 别名,再也不怕记不住命令了!
Upgrade openssl-1.1.1p for openssl-1.0.2k
GFS分布式文件系統
单商户V4.4,初心未变,实力依旧!
Add noise randomly to open3d point cloud
如何获取localStorage中存储的所有值
Cloudcompare & PCL point cloud randomly adds noise
QT--线程
Problem solving win10 quickly open ipynb file
Rasa 3.x 学习系列-Rasa 3.2.1 新版本发布