This article mainly introduces the time difference between two go language computing methods, involving Python operation time skills. if you need a friend, refer to the example below to describe the time difference between two go language computing methods. Share it with you for your reference. The specific analysis is as follows:
The go language calculates the time difference between the two time periods. the code is very simple. it returns the time from one day ago, one week ago, or before January 1, January.
Package mainimport ("fmt" "time") func main () {// The Add method is the opposite of the Sub method, obtain the time distance between t0 and t1. d is to use Sub // Add t0 to d to obtain t1. Then, use the Add method k: = time. now () // d, _: = time. parseDuration ("-24 h") fmt. println (k. add (d) // fmt a week ago. println (k. add (d * 7) // fmt before January 1, January. println (k. add (d * 30 ))}
I hope this article will help you with Python programming.