This module provides minimal time and date functions. For a
newer and more complete module, see the datetime
module.
Epoch time is the time in seconds since some arbitrary starting point. For example, Unix measures time in seconds since January 1, 1970.
UTC is Coordinated Universal Time, the time on the zero meridian (which goes through London).
DST refers to Daylight Savings Time.
A time tuple is a 9tuple
with these elements,
all integers:
T
 Fourdigit year. 
 Second, in [0,59]. 
 Month, 1 for January, 12 for December. 
 Day of week, 0 for Monday, 6 for Sunday. 
 Day of month, in [1,31]. 
 Ordinal day of the year, in [1,366]. 
 Hour, in [0,23]. 

DST flag: 1 if the time is DST, 0 if it is not DST, and 1 if
unknown.

 Minute, in [0,59]. 
Contents of the time
module:
altzone
The local DST offset, in seconds west of UTC (negative for east of UTC).
asctime([T
])
For a timetuple
, returns a string of exactly 24 characters
with this format:
T
"Thu Jun 12 15:25:31 1997"
The default time is now.
clock()
The accumulated CPU time of the current process in seconds, as a float.
ctime([E
])
Converts an epoch time
to a string with the same
format as E
asctime()
. The default time is
now.
daylight
Nonzero if there is a DST value defined locally.
gmtime([E
])
Returns the timetuple corresponding to UTC at epoch
time
; the
DST flag will be zero. The default time is now.
E
localtime([E
])
Returns the timetuple corresponding to local time at
epoch time
. The default time is now.
E
mktime(T
)
Converts a timetuple
to epoch time as a float,
where T
is
the local time.
T
sleep(s
)
Suspend execution of the current process for
seconds, where
s
can be a
float or integer.
s
strftime(f
[,t
])
Time formatting function; formats a timetuple
according to format string t
. The default time f
is now. As
with the old string
format operator, format codes start with
t
%
, and other text appears unchanged
in the result. See the table of codes
below.
time()
The current epoch time, as a float.
timezone
The local nonDST time zone as an offset in seconds west of UTC (negative for east of UTC). This value applies when daylight savings time is not in effect.
tzname
A 2tuple (
, s
) where
d
is the
name of the nonDST time zone locally and s
is the name of
the local DST time zone. For example, in Socorro, NM,
you get d
('MST', 'MDT')
.
Format codes for the strftime
function include:
%a 
Abbreviated weekday name, e.g., 'Tue' .

%A 
Full weekday name, e.g., 'Tuesday' .

%b

Abbreviated month name, e.g., 'Jul' .

%B 
Full month name, e.g., 'July' .

%d 
Day of the month, two digits with left zero fill; e.g.
'03' .

%H  Hour on the 24hour clock, two digits with zero fill. 
%I  Hour on the 12hour clock, two digits with zero fill. 
%j  Day of the year as a decimal number, three digits with zero fill, e.g. '366'. 
%m  Decimal month, two digits with zero fill. 
%M  Minute, two digits with zero fill. 
%p 
Either 'AM' or 'PM' .
Midnight is considered AM and noon PM.

%S  Second, two digits with zero fill. 
%w  Numeric weekday: 0 for Sunday, 6 for Saturday. 
%y  Twodigit year. Not recommended! 
%Y  Fourdigit year. 
%Z 
If there is a time zone, a string representing that
zone; e.g., 'PST' .

%% 
Outputs the character % .
