Python date operation:
>>> Import time>>> Print time.localtime () #strcy_time元组time. Struct_time (tm_year=2017, TM_MON=12, TM _mday=30, tm_hour=15, tm_min=26, tm_sec=47, tm_wday=5, tm_yday=364, tm_isdst=0) >>> print time.strftime ("%Y-% m-%d%h:%m:%s ", Time.localtime ()) 2017-12-30 15:27:49>>> print time.strftime ("%z:%y-%m-%d%H:%M:%S ", Time.localtime ()) Eastern Standard Time: 2017-12-30 15:27:55
Python time-date formatting symbols:
%y Two-digit year representation (00-99)
%y Four-digit year representation (000-9999)
%m Month (01-12)
%d months of the day (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 Local simplified month name
%b Local full month name
%c Local corresponding date representation and time represents
%j year of the Day (001-366)
%p The equivalent of a local a.m. or P.M.
%u Week of the Year (00-53) Sunday is the beginning of the week
%w Week (0-6), Sunday is 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% itself
Serial Number |
Properties |
value |
0 |
Tm_year |
2008 |
1 |
Tm_mon |
1 to 12 |
2 |
Tm_mday |
1 to 31 |
3 |
Tm_hour |
0 to 23 |
4 |
Tm_min |
0 to 59 |
5 |
Tm_sec |
0 to 61 (60 or 61 is a leap second) |
6 |
Tm_wday |
0 to 6 (0 is Monday) |
7 |
Tm_yday |
1 to 366 (Julian calendar) |
8 |
Tm_isdst |
-1, 0, 1,-1 is the flag that decides whether to be daylight saving time |
Python Date and time