Home | Trees | Indices | Help |
---|
|
A pyfdate.Period is an amount of time.
pyfdate.Period performs a function similar to the standard library datetime.timedelta. pyfdate.Period, however, is implemented differently than the datetime.timedelta class. pyfdate.Period stores only a single value: self.period_seconds. This may be a positive or negative value.
pyfdate.Period objects (like datetime.timedelta objects) are used to do date arithmetic. But since pyfdate.Time provides more sophisticated date arithmetic features than datetime.datetime, pyfdate. Periods are probably more widely used for their display capabilities than for their date arithmetic capabilities.
|
|||
Period |
|
||
Period |
|
||
Period |
|
||
boolean |
|
||
boolean |
|
||
boolean |
|
||
boolean |
|
||
boolean |
|
||
boolean |
|
||
string |
|
||
Period |
|
||
Period |
|
||
Period |
|
||
Period |
|
||
Period |
|
||
Period |
|
||
int |
|
||
int |
|
||
int |
|
||
int |
|
||
string |
|
||
string |
|
||
string |
|
||
timedelta |
|
||
tuple |
|
||
int |
|
||
int |
|
||
int |
|
||
int |
|
|
|||
int |
days Return the days portion of the period, as an int. |
||
int |
hours Return the hours portion of the Period, as an int. |
||
int |
minutes Return the minutes portion of the Period, as an int. |
||
int |
seconds Return the seconds portion of the Period, as an int. |
||
string |
p Return myself in a nicely-formatted string. |
||
string |
short Return myself as a nicely formatted string: suppress components whose value is zero. |
||
string |
shortest Return myself as a nicely formatted string: suppress components whose value is zero. |
||
timedelta |
timedelta Returns a Period expressed as a datetime.timedelta object |
||
tuple |
tuple Returns myself formatted as a 4-tuple of ints (days, hours, minutes, seconds). |
||
int |
asDays Returns this Period, expressed in units of days. |
||
int |
asHours Returns this Period, expressed in units of hours. |
||
int |
asMinutes Returns this Period, expressed in units of minutes. |
||
int |
asSeconds Returns this Period, expressed in units of seconds. |
|
Thhe constructor of a Period object. Constructor expects arguments of:
|
Returns a clone of myself, with my absolute value.
|
Add one period to another.
|
Returns a string representation of a Period.
|
Subtract one period from another.
|
A general method for subtracting time from a Period object.
Note: Example: : p1 = Period() p2 = p1.plus(weeks=2,days=3,hours=4,minutes=99, seconds=1) |
A general method for subtracting time from a Period object.
Note: Example: : p1 = Period() p2 = p1.plus(weeks=2,days=3,hours=4,minutes=99, seconds=1) |
A general method for adding time to a Period object. To subtract time, add time in negative increments or use the subtract() method.
Note: Example: p1 = Period() p2 = p1.plus(weeks=2,days=3,hours=4,minutes=99, seconds=1) |
A general method for adding time to a Period object. To subtract time, add time in negative increments or use the subtract() method.
Note: Example: p1 = Period() p2 = p1.plus(weeks=2,days=3,hours=4,minutes=99, seconds=1) |
Return a clone of myself.
|
Return the days portion of the period, as an int.
|
Return the hours portion of the Period, as an int.
|
Return the minutes portion of the Period, as an int.
|
Return the seconds portion of the Period, as an int.
|
Return myself in a nicely-formatted string.
Note: : if keyword arg showZeroComponents == True: all components (days, hours, minutes, seconds) will be shown else: only non-zero components (except seconds) will be shown if the period is empty (has a duration of zero): if keyword arg showZeroPeriod == True: return "0 seconds" else: return "" # the empty string |
Return myself as a nicely formatted string: suppress components whose value is zero.
Note: This method will never return an empty string. If my duration is zero, then it returns the string "0 seconds" |
Return myself as a nicely formatted string: suppress components whose value is zero.
Note: If my duration is 0, this method will return an empty string. |
Returns a Period expressed as a datetime.timedelta object
|
Returns myself formatted as a 4-tuple of ints (days, hours, minutes, seconds).
|
Returns this Period, expressed in units of days.
|
Returns this Period, expressed in units of hours.
|
Returns this Period, expressed in units of minutes.
|
Returns this Period, expressed in units of seconds.
|
|
daysReturn the days portion of the period, as an int.
|
hoursReturn the hours portion of the Period, as an int.
|
minutesReturn the minutes portion of the Period, as an int.
|
secondsReturn the seconds portion of the Period, as an int.
|
pReturn myself in a nicely-formatted string.
Note: : if keyword arg showZeroComponents == True: all components (days, hours, minutes, seconds) will be shown else: only non-zero components (except seconds) will be shown if the period is empty (has a duration of zero): if keyword arg showZeroPeriod == True: return "0 seconds" else: return "" # the empty string |
shortReturn myself as a nicely formatted string: suppress components whose value is zero.
Note: This method will never return an empty string. If my duration is zero, then it returns the string "0 seconds" |
shortestReturn myself as a nicely formatted string: suppress components whose value is zero.
Note: If my duration is 0, this method will return an empty string. |
timedeltaReturns a Period expressed as a datetime.timedelta object
|
tupleReturns myself formatted as a 4-tuple of ints (days, hours, minutes, seconds).
|
asDaysReturns this Period, expressed in units of days.
|
asHoursReturns this Period, expressed in units of hours.
|
asMinutesReturns this Period, expressed in units of minutes.
|
asSecondsReturns this Period, expressed in units of seconds.
|
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Sat Aug 30 08:52:50 2008 | http://epydoc.sourceforge.net |