import time
time.strftime("%Y%m%d %X", time.localtime()) #Current time zone
time.strftime("%Y%m%d %X", time.gmtime( time.time()))#0 time zone
The following is the explanation of format string:
strftime(format[, tuple]) -> string
Will specify struct_time (default is the current time) according to the specified format String output
Time and date formatting symbols in Python:
%y Two-digit year representation (00-99)
%Y Four-digit year representation (000-9999)
%m Month (01-12)
%d Day in the month (0-31)
%H 24-hour hour (0-23)
%I 12-hour hour (01-12)
%M Minutes (00=59)
%S Seconds (00-59)
%a Local simplified week name
%A Local complete week name
%b Local simplified month name
%B Local complete month name
%c Local corresponding date representation and time representation
%j Day of the year (001-366)
%p Equivalent of local A.M. or P.M.
%U Number of weeks in the year (00-53) Sunday is the start of the week
%w Week of the week (0-6) , Sunday is the beginning of the week
%W The number of weeks in the year (00-53) Monday is the beginning of the week
%x The corresponding local date representation
%X The corresponding local time representation
%Z The name of the current time zone
%% % number itself
The above is the content of python displaying the current time. For more related content, please pay attention to the PHP Chinese website (m.sbmmt.com)!