Python simple time formatting method [strftime function], pythonstrftime
This article describes the Python simple time formatting method and shares it with you for your reference. The details are as follows:
Walker often uses the current time and relative time to calculate the efficiency of program execution. It is easy to copy.
>>> Import time >>> startTime = time. time () >>> '%. 2fs '% (time. time ()-startTime) # relative time '24. 51s '>>> '{:. 2f} s '. format (time. time ()-startTime) # relative time '37. 55s '> time. strftime ('% Y-% m-% d % H: % M: % s', time. localtime (time. time () # format the current time '2017-01-05 10:34:06'
PS: This site also provides a Unix timestamp Conversion Tool (which summarizes timestamp operations in various common languages), which is very practical and provides you with reference:
Unix timestamp Conversion Tool:
Http://tools.jb51.net/code/unixtime