Preface
In the development of using Go, sometimes formatting time is required, and the formatting time of the Go language is a bit special. Please use it on January 2, 2006 at 15:04:05
Go formatting time
format time
![]()
The output result is
![]()
![]()
The output result is
![]()
![]()
The output result is
![]()
Can use Chinese
![]()
The output result is
![]()
12 hour clock and AM/PM
![]()
The output result is
![]()
Milliseconds, microseconds, nanoseconds
![]()
The output result is
![]()
summary
The parameter of the time. Format() method is not a "pattern string", but a specific date and time example. You must use fixed numbers such as 2006, 01, 02, 15, 04, and 05 to represent the corresponding year, month, day, hour, minute, and second.