ping
index
/home/ping/web/bc/date/ping.py

Provide the Date class, to represent dates in the Western calendar.

 
Classes
            
Date
 
class Date
      Instances of this class represent a date in the Western calendar.
 
Dates can be converted to strings, and integers can be added to and
subtracted from dates to adjust them by a given number of days.
 
   Methods defined here:
__add__(self, days)
Add an integer number of days from this Date, yielding a Date.
 
Adding a positive number will advance forward in time;
adding a negative number will step backward in time.
__cmp__(self, other)
__init__(self, year, month, day)
Construct a Date, given numbers for the year, month, and day.
__repr__(self)
__str__(self)
Convert this date into a string in YYYY-MM-DD format.
__sub__(self, other)
Subtract an integer number of days from this Date, yielding a Date.
 
Subtracting a positive number will step backward in time;
subtracting a negative number will advance forward in time.
longformat(self)
Convert this date into a form such as 'February 26, 2003'.
next(self)
Return the Date of the day immediately following this Date.
prev(self)
Return the Date of the day immediately preceding this Date.

Data and non-method functions defined here:
__doc__ = 'Instances of this class represent a date in the... dates to adjust them by a given number of days.'
__module__ = 'ping'

 
Functions
            
isleap(year)
Return 1 for leap years, 0 for non-leap years.
makedate(strdate)
Construct a Date object from a string in YYYY-MM-DD format.
 
The string must have exactly 10 characters, with two hyphens
in the right positions, and digits in all other positions.
monthdays(year, month)
Return the number of days in a given month of a given year.

 
Data
             __file__ = './ping.pyc'
__name__ = 'ping'
mdays = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
months = ['x', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']