| |
- Date
- exceptions.Exception
-
- InvalidDateError
class Date |
|
Date is a class for representing and manipulating dates.
The <, >, <=, =>, ==, and != operators work for comparing dates
as expected, and + and - can be used to add or subtract some number
of days to a date object. |
|
Methods defined here:
- __add__(self, days)
- __cmp__(self, other)
- Return 1 if the self date object is a later date than the argument
date object; -1 if the self date object is an earlier date than the
argument date object; 0 if the two dates are equal.
- __init__(self, intDate=(-1, -1, -1))
- Construct a Date from a 3-tuple of integers for year,
month, and day. Set date to -1, -1, -1 if no argument is given.
This is so that the date can be set with the setYMDDate method.
- __str__(self)
- Return a string representation of the current date, in
YYYY-MM-DD format.
- __sub__(self, days)
- addDays(self, days)
- Add an integer number of days to the current date.
- convertIntMonth(self, month)
- convertIntYMD(self, intDate)
- Return a YYYY-MM-DD date given a 3-tuple of year, month, and day.
- convertStringMonth(self, month)
- convertYMDInt(self, ymdDate)
- Return a 3-tuple of year, month, and day given a YYYY-MM-DD
string.
- getDaysInMonth(self, month, year)
- Return the number of days in a month, given a month 1-12
and a year. Return 0 if the month is not in the range 1-12.
- getIntDate(self)
- Get the date as a 3-tuple of year, month, and day integers.
- getNextDay(self, date)
- Return the next day as a 3-tuple of year, month, and date given
a date in the same format.
- getPreviousDay(self, date)
- Return the previous day in YYYY-MM-DD format when given a date in
the same format.
- getPreviousMonth(self)
- Subtract 1 month from the current date.
- getStringDate(self)
- Return the date in String format -- for example,
'March 1, 2003'.
- getYMDDate(self)
- Return the date in YYYY-MM-DD format.
- getnextMonth(self, month)
- Return the next month as an integer given an integer month.
- isDateValid(self)
- Return 1 if the month and number of days for that month
are valid. Return 0 otherwise.
- nextDay(self)
- Add 1 day to the current date.
- previousDay(self)
- Subtract 1 day from the current date.
- setIntDate(self, intDate)
- Set the date given a 3-tuple of integers for year, month, and
day.
- setYMDDate(self, ymdDate)
- Set the date given a YYYY-MM-DD string.
- subtractsDays(self, days)
- Subtract an integer number of days from the current date.
Data and non-method functions defined here:
- __doc__ = 'Date is a class for representing and manipulati...tract some number\n of days to a date object.'
- __module__ = 'scott'
|
|