wx.TimeSpan class represents a time interval.
See also
Default constructor, constructs a zero timespan. |
|
Returns the absolute value of the timespan: does not modify the object. |
|
Adds the given wx.TimeSpan to this wx.TimeSpan and returns a reference to itself. |
|
Returns the timespan for one day. |
|
Returns the timespan for the given number of days. |
|
Returns the string containing the formatted representation of the time span. |
|
Returns the difference in number of days. |
|
Returns the difference in number of hours. |
|
Returns the difference in number of milliseconds. |
|
Returns the difference in number of minutes. |
|
Returns the difference in number of seconds. |
|
Returns the internal representation of timespan. |
|
Returns the difference in number of weeks. |
|
Returns the timespan for one hour. |
|
Returns the timespan for the given number of hours. |
|
Returns |
|
Compares two timespans: works with the absolute values, i.e. -2 hours is longer than 1 hour. |
|
Returns |
|
Returns |
|
Returns |
|
Compares two timespans: works with the absolute values, i.e. 1 hour is shorter than -2 hours. |
|
Returns the timespan for one millisecond. |
|
Returns the timespan for the given number of milliseconds. |
|
Returns the timespan for one minute. |
|
Returns the timespan for the given number of minutes. |
|
Multiplies this time span by n. |
|
Negate the value of the timespan. |
|
Returns timespan with inverted sign. |
|
Returns the timespan for one second. |
|
Returns the timespan for the given number of seconds. |
|
Subtracts the given wx.TimeSpan to this wx.TimeSpan and returns a reference to itself. |
|
Returns the timespan for one week. |
|
Returns the timespan for the given number of weeks. |
wx.
TimeSpan
(object)¶Possible constructors:
TimeSpan()
TimeSpan(hours, min=0, sec=0, msec=0)
TimeSpan class represents a time interval.
__init__
(self, *args, **kw)¶__init__ (self)
Default constructor, constructs a zero timespan.
__init__ (self, hours, min=0, sec=0, msec=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.
hours (long) –
min (long) –
sec (long) –
msec (long) –
Abs
(self)¶Returns the absolute value of the timespan: does not modify the object.
Add
(self, diff)¶Adds the given wx.TimeSpan to this wx.TimeSpan and returns a reference to itself.
diff (wx.TimeSpan) –
Day
()¶Returns the timespan for one day.
Days
(days)¶Returns the timespan for the given number of days.
days (long) –
Format
(self, format=DefaultTimeSpanFormat)¶Returns the string containing the formatted representation of the time span.
The following format specifiers are allowed after %:
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
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.
format (string) –
string
GetDays
(self)¶Returns the difference in number of days.
int
GetHours
(self)¶Returns the difference in number of hours.
int
GetMilliseconds
(self)¶Returns the difference in number of milliseconds.
long
GetMinutes
(self)¶Returns the difference in number of minutes.
int
GetSeconds
(self)¶Returns the difference in number of seconds.
long
GetValue
(self)¶Returns the internal representation of timespan.
long
GetWeeks
(self)¶Returns the difference in number of weeks.
int
Hour
()¶Returns the timespan for one hour.
Hours
(hours)¶Returns the timespan for the given number of hours.
hours (long) –
IsEqualTo
(self, ts)¶Returns True
if two timespans are equal.
ts (wx.TimeSpan) –
bool
IsLongerThan
(self, 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.
ts (wx.TimeSpan) –
bool
IsNegative
(self)¶Returns True
if the timespan is negative.
bool
IsNull
(self)¶Returns True
if the timespan is empty.
bool
IsPositive
(self)¶Returns True
if the timespan is positive.
bool
IsShorterThan
(self, 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.
ts (wx.TimeSpan) –
bool
Millisecond
()¶Returns the timespan for one millisecond.
Milliseconds
(ms)¶Returns the timespan for the given number of milliseconds.
ms (long) –
Minute
()¶Returns the timespan for one minute.
Minutes
(min)¶Returns the timespan for the given number of minutes.
min (long) –
Multiply
(self, n)¶Multiplies this time span by n.
n (int) –
A reference to this wx.TimeSpan object modified in place.
Neg
(self)¶Negate the value of the timespan.
See also
Negate
(self)¶Returns timespan with inverted sign.
See also
Second
()¶Returns the timespan for one second.
Seconds
(sec)¶Returns the timespan for the given number of seconds.
sec (long) –
Subtract
(self, diff)¶Subtracts the given wx.TimeSpan to this wx.TimeSpan and returns a reference to itself.
diff (wx.TimeSpan) –
Week
()¶Returns the timespan for one week.
Weeks
(weeks)¶Returns the timespan for the given number of weeks.
weeks (long) –