| |
- exceptions.Exception(exceptions.BaseException)
-
- util.Date.DateParseError
- util.Date.Date
class Date |
|
A date may be any date (including forever into the past and forever into
the future).
A date is assumed to be immutable - multiple entities may safely refer
to the same date. For this reason, there are no "set" methods.
Public data members:
/time/::
Internal representation of the date - seconds since the beginning of
the epoch. *Don't modify this.*
This attribute used to contain the internal representation, but now
it is a _pseudo-attribute_: it is computed upon demand.
This class includes a number of class variables for symbolic constants:
*sunday*, *monday*, *tuesday*, *wednesday*, *thursday*, *friday*,
*saturday*, *january*, *february*, *march*, *april*, *may*, *june*,
*july*, *august*, *september*, *october*, *november*, *december*. |
|
Methods defined here:
- __add__(self, days)
- Returns a new date consisting of the given date plus /days/.
- __cmp__(self, other)
- Allows us to use the comparison operators on dates.
- __getattr__(self, attr)
- Provides the transparent computation of the time attribute.
- __init__(self, time=0, stdfmt='', other=None, year=0, month=0, day=0, foreverPast=0, foreverFuture=0, now=0)
- __setstate__(self, dict)
- Allows conversion from old-style representation.
- __str__(self)
- Returns the date formatted in the new standard format.
- __sub__(self, other)
- Returns the difference (in days) between two dates. A day is assumed
to be 86400 seconds.
If /other/ is not a date, but is a number, a new date is returned that
is /other/ days before /self/.
- dst(self)
- Returns true if daylight savings time is in effect for this date,
false if not.
- format(self, formatStr)
- Returns the date and time formated using the strftime function.
- formatNewStd(self)
- Returns a string consisting of the receiver formatted as `mm/dd/yyyy`
- formatShort(self)
- Returns a string consisting of the receiver formatted as mmddyy
- formatStd(self)
- Returns a string consisting of the receiver formatted as `mm/dd/yy`
- getDay(self)
- Returns the day of the month.
- getDayOfWeek(self)
- Returns the current day of the week as a number.
- getMonth(self)
- Returns the month
- getYear(self)
- Returns the year.
- last(self, weekday)
- Returns a new date which is the given /weekday/ immediately prior to
the date of /self/. If /self/s date falls on that weekday, returns
a copy of /self/.
- next(self, weekday)
- Returns a new date which is the given /weekday/ following the date of
/self/. If /self/s date falls on that weekday, returns a copy of /self/.
- ymd(self)
- Returns a tuple consisting of the year, month, and day.
Data and other attributes defined here:
- april = 4
- august = 8
- december = 12
- february = 2
- friday = 5
- january = 1
- july = 7
- june = 6
- march = 3
- may = 5
- monday = 1
- november = 11
- october = 10
- saturday = 6
- september = 9
- sunday = 0
- thursday = 4
- tuesday = 2
- wednesday = 3
|
|