The code is as follows:
Import time
Print Time.time ()
Print Time.localtime (Time.time ())
Print time.strftime ('%y-%m-%d ', Time.localtime ())
Print time.strftime ('%y-%m-%d ', Time.localtime ())
Print Time.strftime ('%y-%m-%d%h:%m:%s ', Time.localtime ())
Print Time.strftime ('%y-%m-%d%i:%m:%s ', Time.localtime ())
Print Time.strftime ('%y-%m-%d%h:%m:%s--%a--%c ', Time.localtime ())
Print Time.strftime ('%y-%m-%d%h:%m:%s--%x--%x ', Time.localtime ())
Here are the effects:
The code is as follows:
1295099282.16
Time.struct_time (tm_year=2011, Tm_mon=1, tm_mday=15, tm_hour=21, tm_min=48, tm_sec=2, tm_wday=5, tm_yday=15, tm_isdst= 0)
2011-01-15
11-01-15
2011-01-15 21:48:02
2011-01-15 09:48:02
2011-01-15 21:48:02--SATURDAY--01/15/11 21:48:02
2011-01-15 21:48:02--01/15/11--21:48:02
The following is a description of Time.strftime specific parameters:
There are a lot of parameters in the Time.strftime that will allow you to freely output what you want:
The following are the parameters of Time.strftime:
Strftime (format[, tuple]), string
Outputs the specified Struct_time (default current time), based on the specified formatted string
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