This class is a “logical time span” and is useful for implementing program logic for such things as “add one month to the date” which, in general, doesn’t mean to add 60x60x24x31 seconds to it, but to take the same date the next month (to understand that this is indeed different consider adding one month to Feb, 15
When adding a month to the date, all lesser components (days, hours, ...) won’t be changed unless the resulting date would be invalid: for example, Jan 31 + 1 month will be Feb 28, not (nonexisting) Feb 31.
Because of this feature, adding and subtracting back again the same wx.DateSpan will not, in general, give back the original date: Feb 28  1 month will be Jan 28, not Jan 31!
wx.DateSpan objects can be either positive or negative. They may be multiplied by scalars which multiply all deltas by the scalar: i.e. 2(1 month and 1 day) is 2 months and 2 days. They can be added together with wx.DateTime or wx.TimeSpan, but the type of result is different for each case.
Equality operators are defined for DateSpans. Two DateSpans are equal if and only if they both give the same target date when added to every source date. Thus DateSpan.Months(1) is not equal to DateSpan.Days(30), because they don’t give the same date when added to Feb 1st. But DateSpan.Days(14) is equal to DateSpan.Weeks(2).
Finally, notice that for adding hours, minutes and so on you don’t need this class at all: wx.TimeSpan will do the job because there are no subtleties associated with those (we don’t support leap seconds).
Warning
If you specify both weeks and days, the total number of days added will be 7weeks + days! See also GetTotalDays
.
See also
__init__ 
Constructs the date span object for the given number of years, months, weeks and days. 
Add 
Adds the given wx.DateSpan to this wx.DateSpan and returns a reference to itself. 
Day 
Returns a date span object corresponding to one day. 
Days 
Returns a date span object corresponding to the given number of days. 
GetDays 
Returns the number of days (not counting the weeks component) in this date span. 
GetMonths 
Returns the number of the months (not counting the years) in this date span. 
GetTotalDays 
Returns the combined number of days in this date span, counting both weeks and days. 
GetTotalMonths 
Returns the combined number of months in this date span, counting both years and months. 
GetWeeks 
Returns the number of weeks in this date span. 
GetYears 
Returns the number of years in this date span. 
Month 
Returns a date span object corresponding to one month. 
Months 
Returns a date span object corresponding to the given number of months. 
Multiply 
Multiplies this date span by the specified factor. 
Neg 
Changes the sign of this date span. 
Negate 
Returns a date span with the opposite sign. 
SetDays 
Sets the number of days (without modifying any other components) in this date span. 
SetMonths 
Sets the number of months (without modifying any other components) in this date span. 
SetWeeks 
Sets the number of weeks (without modifying any other components) in this date span. 
SetYears 
Sets the number of years (without modifying any other components) in this date span. 
Subtract 
Subtracts the given wx.DateSpan to this wx.DateSpan and returns a reference to itself. 
Week 
Returns a date span object corresponding to one week. 
Weeks 
Returns a date span object corresponding to the given number of weeks. 
Year 
Returns a date span object corresponding to one year. 
Years 
Returns a date span object corresponding to the given number of years. 
wx.
DateSpan
(object)¶Possible constructors:
DateSpan(years=0, months=0, weeks=0, days=0)
This class is a “logical time span” and is useful for implementing program logic for such things as “add one month to the date” which, in general, doesn’t mean to add 60x60x24x31 seconds to it, but to take the same date the next month (to understand that this is indeed different consider adding one month to Feb, 15 we want to get Mar, 15, of course).
__init__
(self, years=0, months=0, weeks=0, days=0)¶Constructs the date span object for the given number of years, months, weeks and days.
Note that the weeks and days add together if both are given.
Parameters: 


Add
(self, other)¶Adds the given wx.DateSpan to this wx.DateSpan and returns a reference to itself.
Parameters:  other (wx.DateSpan) – 

Return type:  wx.DateSpan 
Day
()¶Returns a date span object corresponding to one day.
Return type:  wx.DateSpan 

See also
Days
(days)¶Returns a date span object corresponding to the given number of days.
Parameters:  days (int) – 

Return type:  wx.DateSpan 
See also
GetDays
(self)¶Returns the number of days (not counting the weeks component) in this date span.
Return type:  int 

See also
GetMonths
(self)¶Returns the number of the months (not counting the years) in this date span.
Return type:  int 

GetTotalDays
(self)¶Returns the combined number of days in this date span, counting both weeks and days.
This doesn’t take months or years into account.
Return type:  int 

GetTotalMonths
(self)¶Returns the combined number of months in this date span, counting both years and months.
Return type:  int 

New in version 2.9.5.
GetWeeks
(self)¶Returns the number of weeks in this date span.
Return type:  int 

See also
GetYears
(self)¶Returns the number of years in this date span.
Return type:  int 

Month
()¶Returns a date span object corresponding to one month.
Return type:  wx.DateSpan 

See also
Months
(mon)¶Returns a date span object corresponding to the given number of months.
Parameters:  mon (int) – 

Return type:  wx.DateSpan 
See also
Multiply
(self, factor)¶Multiplies this date span by the specified factor.
The product is computed by multiplying each of the components by the factor.
Parameters:  factor (int) – 

Return type:  wx.DateSpan 
Returns:  A reference to this wx.DateSpan object modified in place. 
Neg
(self)¶Changes the sign of this date span.
Return type:  wx.DateSpan 

See also
Negate
(self)¶Returns a date span with the opposite sign.
Return type:  wx.DateSpan 

See also
SetDays
(self, n)¶Sets the number of days (without modifying any other components) in this date span.
Parameters:  n (int) – 

Return type:  wx.DateSpan 
SetMonths
(self, n)¶Sets the number of months (without modifying any other components) in this date span.
Parameters:  n (int) – 

Return type:  wx.DateSpan 
SetWeeks
(self, n)¶Sets the number of weeks (without modifying any other components) in this date span.
Parameters:  n (int) – 

Return type:  wx.DateSpan 
SetYears
(self, n)¶Sets the number of years (without modifying any other components) in this date span.
Parameters:  n (int) – 

Return type:  wx.DateSpan 
Subtract
(self, other)¶Subtracts the given wx.DateSpan to this wx.DateSpan and returns a reference to itself.
Parameters:  other (wx.DateSpan) – 

Return type:  wx.DateSpan 
Week
()¶Returns a date span object corresponding to one week.
Return type:  wx.DateSpan 

See also
Weeks
(weeks)¶Returns a date span object corresponding to the given number of weeks.
Parameters:  weeks (int) – 

Return type:  wx.DateSpan 
See also
Year
()¶Returns a date span object corresponding to one year.
Return type:  wx.DateSpan 

See also
Years
(years)¶Returns a date span object corresponding to the given number of years.
Parameters:  years (int) – 

Return type:  wx.DateSpan 
See also