1.python Time Formatting symbols
Python format symbols in time date:
%y two-digit Year representation (00-99)
%Y four-digit Year representation (000-9999)
%m Month (01-12)
One day in%d months (0-31)
%H 24-hour hours (0-23)
%I 12-hour hours (01-12)
%M minutes (00=59)
%s seconds (00-59)
%a Local Simplified Week name
%A Local Full week name
%b a locally simplified month name
%B Local Full month name
%c Local corresponding date representation and time representation
%j Day of the year (001-366)
%p the equivalent of a local a.m. or p.m.
%u weeks of the year (00-53) Sunday is the beginning of the week
%w Week (0-6), Sunday for the beginning of the week
%W Week of the year (00-53) Monday is the beginning of the week
%x Local corresponding date representation
%x Local corresponding time representation
%Z the name of the current time zone
Percent% of the number itself
2. Get the current time
Import Time #返回当前时间 def getnowtime () return time.strftime ("%y-%m-%d%h:%m:%s", time.localtime (time.time ()))
This article is from the "world is the same" blog, please be sure to keep this source http://970076933.blog.51cto.com/9767314/1870042
Python learning notes: getting system time