*********** wx.TimeSpan *********** Inheritance diagram for `wx.TimeSpan`: | .. inheritance-diagram:: wx.TimeSpan | Description =========== `wx.TimeSpan` class represents a time interval. Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `Abs <#Abs>`_ * `Add <#Add>`_ * `Day <#Day>`_ * `Days <#Days>`_ * `Format <#Format>`_ * `GetDays <#GetDays>`_ * `GetHours <#GetHours>`_ * `GetMilliseconds <#GetMilliseconds>`_ * `GetMinutes <#GetMinutes>`_ * `GetSeconds <#GetSeconds>`_ * `GetWeeks <#GetWeeks>`_ * `Hour <#Hour>`_ * `Hours <#Hours>`_ * `IsEqualTo <#IsEqualTo>`_ * `IsLongerThan <#IsLongerThan>`_ * `IsNegative <#IsNegative>`_ * `IsNull <#IsNull>`_ * `IsPositive <#IsPositive>`_ * `IsShorterThan <#IsShorterThan>`_ * `Millisecond <#Millisecond>`_ * `Milliseconds <#Milliseconds>`_ * `Minute <#Minute>`_ * `Minutes <#Minutes>`_ * `Multiply <#Multiply>`_ * `Neg <#Neg>`_ * `Second <#Second>`_ * `Seconds <#Seconds>`_ * `Subtract <#Subtract>`_ * `Week <#Week>`_ * `Weeks <#Weeks>`_ Properties Summary ^^^^^^^^^^^^^^^^^^ * `days <#days>`_ * `hours <#hours>`_ * `milliseconds <#milliseconds>`_ * `minutes <#minutes>`_ * `seconds <#seconds>`_ * `weeks <#weeks>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__(hours=0, minutes=0, seconds=0, milliseconds=0) Constructs timespan from separate values for each component, with the date set to 0. Hours are not restricted to 0..24 range, neither are minutes, seconds or milliseconds. **Parameters:** * `hours` (long) * `minutes` (long) * `seconds` (long) * `milliseconds` (long) | **Returns:** `wx.TimeSpan `_ -------- .. method:: Abs() Returns the absolute value of the timespan: does not modify the object. | **Returns:** `wx.TimeSpan `_ -------- .. method:: Add(diff) Returns the sum of two timespans. **Parameters:** * `diff` (`wx.TimeSpan `_) | **Returns:** `wx.TimeSpan `_ -------- .. method:: Day() Returns the timespan for one day. | **Returns:** `wx.TimeSpan `_ -------- .. method:: Days(days) Returns the timespan for the given number of days. **Parameters:** * `days` (long) | **Returns:** `wx.TimeSpan `_ -------- .. method:: Format(format=wx.DefaultTimeSpanFormat) Returns the string containing the formatted representation of the time span. The following format specifiers are allowed after ``%``: ==================== ===================================== TimeSpan Format Description ==================== ===================================== H number of Hours M number of Minutes S number of Seconds l number of milliseconds D number of Days E number of wEeks % the percent character ==================== ===================================== **Parameters:** * `format` (string) | **Returns:** `string` .. note:: Note that, for example, the number of hours in the description above is not well defined: it can be either the total number of hours (for example, for a time span of 50 hours this would be 50) or just the hour part of the time span, which would be 2 in this case as 50 hours is equal to 2 days and 2 hours. `wx.TimeSpan` resolves this ambiguity in the following way: if there had been, indeed, the ``%D`` format specified preceding the ``%H``, then it is interpreted as 2. Otherwise, it is 50. The same applies to all other format specifiers: if they follow a specifier of larger unit, only the rest part is taken, otherwise the full value is used. -------- .. method:: GetDays() Returns the difference in number of days. | **Returns:** `int` -------- .. method:: GetHours() Returns the difference in number of hours. | **Returns:** `int` -------- .. method:: GetMilliseconds() Returns the difference in number of milliseconds. | **Returns:** `int` -------- .. method:: GetMinutes() Returns the difference in number of minutes. | **Returns:** `int` -------- .. method:: GetSeconds() Returns the difference in number of seconds. | **Returns:** `int` -------- .. method:: GetWeeks() Returns the difference in number of weeks. | **Returns:** `int` -------- .. method:: Hour() Returns the timespan for one hour. | **Returns:** `wx.TimeSpan `_ -------- .. method:: Hours(hours) Returns the timespan for the given number of hours. **Parameters:** * `hours` (long) | **Returns:** `wx.TimeSpan `_ -------- .. method:: IsEqualTo(ts) Returns ``True`` if two timespans are equal. **Parameters:** * `ts` (`wx.TimeSpan `_) | **Returns:** `bool` -------- .. method:: IsLongerThan(ts) Compares two timespans: works with the absolute values, i.e. -2 hours is longer than 1 hour. Also, it will return ``False`` if the timespans are equal in absolute value. **Parameters:** * `ts` (`wx.TimeSpan `_) | **Returns:** `bool` -------- .. method:: IsNegative() Returns ``True`` if the timespan is negative. | **Returns:** `bool` -------- .. method:: IsNull() Returns ``True`` if the timespan is empty. | **Returns:** `bool` -------- .. method:: IsPositive() Returns ``True`` if the timespan is positive. | **Returns:** `bool` -------- .. method:: IsShorterThan(ts) Compares two timespans: works with the absolute values, i.e. 1 hour is shorter than -2 hours. Also, it will return ``False`` if the timespans are equal in absolute value. **Parameters:** * `ts` (`wx.TimeSpan `_) | **Returns:** `bool` -------- .. method:: Millisecond() Returns the timespan for one millisecond. | **Returns:** `wx.TimeSpan `_ -------- .. method:: Milliseconds(ms) Returns the timespan for the given number of milliseconds. **Parameters:** * `ms` (long) | **Returns:** `wx.TimeSpan `_ -------- .. method:: Minute() Returns the timespan for one minute. | **Returns:** `wx.TimeSpan `_ -------- .. method:: Minutes(min) Returns the timespan for the given number of minutes. **Parameters:** * `min` (long) | **Returns:** `wx.TimeSpan `_ -------- .. method:: Multiply(n) Multiplies timespan by a scalar. **Parameters:** * `n` (int) | **Returns:** `wx.TimeSpan `_ -------- .. method:: Neg() Negate the value of the timespan. | **Returns:** `wx.TimeSpan `_ -------- .. method:: Second() Returns the timespan for one second. | **Returns:** `wx.TimeSpan `_ -------- .. method:: Seconds(sec) Returns the timespan for the given number of seconds. **Parameters:** * `sec` (long) | **Returns:** `wx.TimeSpan `_ -------- .. method:: Subtract(diff) Returns the difference of two timespans. **Parameters:** * `diff` (`wx.TimeSpan `_) | **Returns:** `wx.TimeSpan `_ -------- .. method:: Week() Returns the timespan for one week. | **Returns:** `wx.TimeSpan `_ -------- .. method:: Weeks(weeks) Returns the timespan for the given number of weeks. **Parameters:** * `weeks` (long) | **Returns:** `wx.TimeSpan `_ -------- Properties ^^^^^^^^^^ .. attribute:: days See `GetDays <#GetDays>`_ .. attribute:: hours See `GetHours <#GetHours>`_ .. attribute:: milliseconds See `GetMilliseconds <#GetMilliseconds>`_ .. attribute:: minutes See `GetMinutes <#GetMinutes>`_ .. attribute:: seconds See `GetSeconds <#GetSeconds>`_ .. attribute:: weeks See `GetWeeks <#GetWeeks>`_