Software: Apache/2.0.54 (Unix) mod_perl/1.99_09 Perl/v5.8.0 mod_ssl/2.0.54 OpenSSL/0.9.7l DAV/2 FrontPage/5.0.2.2635 PHP/4.4.0 mod_gzip/2.0.26.1a uname -a: Linux snow.he.net 4.4.276-v2-mono-1 #1 SMP Wed Jul 21 11:21:17 PDT 2021 i686 uid=99(nobody) gid=98(nobody) groups=98(nobody) Safe-mode: OFF (not secure) /opt/doc/python-2.3.4/html/Python-Docs-2.3.4/lib/ drwxr-xr-x | |
| Viewing file: Select action/file-type:
|
| year, month, day) |
MINYEAR <= year <= MAXYEAR
1 <= month <= 12
1 <= day <= number of days in the given month and year
If an argument outside those ranges is given, ValueError is raised.
Other constructors, all class methods:
| ) |
date.fromtimestamp(time.time()).
| timestamp) |
| ordinal) |
1 <= ordinal <= date.max.toordinal().
For any date d, date.fromordinal(d.toordinal()) ==
d.
Class attributes:
date(MINYEAR, 1, 1).
date(MAXYEAR, 12, 31).
timedelta(days=1).
Instance attributes (read-only):
Supported operations:
| Operation | Result |
|---|---|
date2 = date1 + timedelta |
date2 is timedelta.days days removed from
date1. (1) |
date2 = date1 - timedelta |
Computes date2 such that date2 + timedelta
== date1. (2) |
timedelta = date1 - date2 |
(3) |
date1<date2 |
date1 is considered less than date2 when date1 precedes date2 in time. (4) |
Notes:
timedelta.days
> 0, or backward if timedelta.days < 0. Afterward
date2 - date1 == timedelta.days.
timedelta.seconds and
timedelta.microseconds are ignored.
OverflowError is raised if date2.year
would be smaller than MINYEAR or larger than
MAXYEAR.
timedelta.seconds
and timedelta.microseconds are ignored.
date1 < date2
if and only if date1.toordinal() <
date2.toordinal().
In order to stop comparison from falling back to the default
scheme of comparing object addresses, date comparison
normally raises TypeError if the other comparand
isn't also a date object. However, NotImplemented
is returned instead if the other comparand has a
timetuple attribute. This hook gives other kinds of
date objects a chance at implementing mixed-type comparison.
If not, when a date object is
compared to an object of a different type, TypeError is
raised unless the comparison is == or !=. The latter
cases return False or True, respectively.
Dates can be used as dictionary keys. In Boolean contexts, all date objects are considered to be true.
Instance methods:
| year, month, day) |
d == date(2002, 12, 31), then
d.replace(day=26) == date(2000, 12, 26).
| ) |
d.timetuple() is equivalent to
time.struct_time((d.year, d.month, d.day,
0, 0, 0,
d.weekday(),
d.toordinal() - date(d.year, 1, 1).toordinal() + 1,
-1))
| ) |
date.fromordinal(d.toordinal()) == d.
| ) |
date(2002, 12, 4).weekday() == 2, a
Wednesday.
See also isoweekday().
| ) |
date(2002, 12, 4).isoweekday() == 3, a
Wednesday.
See also weekday(), isocalendar().
| ) |
The ISO calendar is a widely used variant of the Gregorian calendar. See http://www.phys.uu.nl/~vgent/calendar/isocalendar.htm for a good explanation.
The ISO year consists of 52 or 53 full weeks, and where a week starts on a Monday and ends on a Sunday. The first week of an ISO year is the first (Gregorian) calendar week of a year containing a Thursday. This is called week number 1, and the ISO year of that Thursday is the same as its Gregorian year.
For example, 2004 begins on a Thursday, so the first week of ISO
year 2004 begins on Monday, 29 Dec 2003 and ends on Sunday, 4 Jan
2004, so that
date(2003, 12, 29).isocalendar() == (2004, 1, 1)
and
date(2004, 1, 4).isocalendar() == (2004, 1, 7).
| ) |
date(2002, 12, 4).isoformat() == '2002-12-04'.
| ) |
str(d) is equivalent to
d.isoformat().
| ) |
d.ctime() is equivalent to
time.ctime(time.mktime(d.timetuple()))
on platforms where the native C ctime() function
(which time.ctime() invokes, but which
date.ctime() does not invoke) conforms to the C standard.
| format) |
See About this document... for information on suggesting changes.
:: Command execute :: | |
--[ c99shell v. 1.0 pre-release build #13 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0108 ]-- |