File: qtime.html

package info (click to toggle)
python-qt4 4.0.1-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 18,632 kB
  • ctags: 2,639
  • sloc: python: 29,409; sh: 5,646; cpp: 3,168; xml: 149; makefile: 109
file content (243 lines) | stat: -rw-r--r-- 23,804 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QTime Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QTime Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QTime class provides clock time functions. <a href="#details">More...</a></p>
<h3>Methods</h3><ul><li><div class="fn" /><b><a href="qtime.html#QTime">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtime.html#QTime-2">__init__</a></b> (<i>self</i>, int&#160;<i>h</i>, int&#160;<i>m</i>, int&#160;<i>s</i>&#160;=&#160;0, int&#160;<i>ms</i>&#160;=&#160;0)</li><li><div class="fn" /><b><a href="qtime.html#QTime-3">__init__</a></b> (<i>self</i>, QTime)</li><li><div class="fn" />QTime <b><a href="qtime.html#addMSecs">addMSecs</a></b> (<i>self</i>, int&#160;<i>ms</i>)</li><li><div class="fn" />QTime <b><a href="qtime.html#addSecs">addSecs</a></b> (<i>self</i>, int&#160;<i>secs</i>)</li><li><div class="fn" />int <b><a href="qtime.html#elapsed">elapsed</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtime.html#hour">hour</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtime.html#isNull">isNull</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtime.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtime.html#minute">minute</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtime.html#msec">msec</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtime.html#msecsTo">msecsTo</a></b> (<i>self</i>, QTime)</li><li><div class="fn" />int <b><a href="qtime.html#restart">restart</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtime.html#second">second</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtime.html#secsTo">secsTo</a></b> (<i>self</i>, QTime)</li><li><div class="fn" />bool <b><a href="qtime.html#setHMS">setHMS</a></b> (<i>self</i>, int&#160;<i>h</i>, int&#160;<i>m</i>, int&#160;<i>s</i>, int&#160;<i>ms</i>&#160;=&#160;0)</li><li><div class="fn" /><b><a href="qtime.html#start">start</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qtime.html#toString">toString</a></b> (<i>self</i>, Qt.DateFormat&#160;<i>f</i>&#160;=&#160;Qt.TextDate)</li><li><div class="fn" />QString <b><a href="qtime.html#toString-2">toString</a></b> (<i>self</i>, QString&#160;<i>format</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />QTime <b><a href="qtime.html#currentTime">currentTime</a></b> ()</li><li><div class="fn" />QTime <b><a href="qtime.html#fromString">fromString</a></b> (QString&#160;<i>s</i>, Qt.DateFormat&#160;<i>f</i>&#160;=&#160;Qt.TextDate)</li><li><div class="fn" />QTime <b><a href="qtime.html#fromString-2">fromString</a></b> (QString&#160;<i>s</i>, QString&#160;<i>format</i>)</li><li><div class="fn" />bool <b><a href="qtime.html#isValid-2">isValid</a></b> (int&#160;<i>h</i>, int&#160;<i>m</i>, int&#160;<i>s</i>, int&#160;<i>ms</i>&#160;=&#160;0)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />bool <b><a href="qtime.html#__eq__">__eq__</a></b> (<i>self</i>, QTime&#160;<i>other</i>)</li><li><div class="fn" />bool <b><a href="qtime.html#__ge__">__ge__</a></b> (<i>self</i>, QTime&#160;<i>other</i>)</li><li><div class="fn" />bool <b><a href="qtime.html#__gt__">__gt__</a></b> (<i>self</i>, QTime&#160;<i>other</i>)</li><li><div class="fn" />bool <b><a href="qtime.html#__le__">__le__</a></b> (<i>self</i>, QTime&#160;<i>other</i>)</li><li><div class="fn" />bool <b><a href="qtime.html#__lt__">__lt__</a></b> (<i>self</i>, QTime&#160;<i>other</i>)</li><li><div class="fn" />bool <b><a href="qtime.html#__ne__">__ne__</a></b> (<i>self</i>, QTime&#160;<i>other</i>)</li><li><div class="fn" />int <b><a href="qtime.html#__nonzero__">__nonzero__</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QTime class provides clock time functions.</p>
<p>A QTime object contains a clock time, i.e. the number of hours, minutes, seconds, and milliseconds since midnight. It can read the current time from the system clock and measure a span of elapsed time. It provides functions for comparing times and for manipulating a time by adding a number of (milli)seconds.</p>
<p>QTime uses the 24-hour clock format; it has no concept of AM/PM. It operates in local time; it knows nothing about time zones or daylight savings time.</p>
<p>A QTime object is typically created either by giving the number of hours, minutes, seconds, and milliseconds explicitly, or by using the static function <a href="qtime-qt3.html#currentTime">currentTime</a>(), which creates a QTime object that contains the system's clock time. Note that the accuracy depends on the accuracy of the underlying operating system; not all systems provide 1-millisecond accuracy.</p>
<p>The <a href="qtime.html#hour">hour</a>(), <a href="qtime.html#minute">minute</a>(), <a href="qtime.html#second">second</a>(), and <a href="qtime.html#msec">msec</a>() functions provide access to the number of hours, minutes, seconds, and milliseconds of the time. The same information is provided in textual format by the <a href="qtime.html#toString">toString</a>() function.</p>
<p>QTime provides a full set of operators to compare two QTime objects. One time is considered smaller than another if it is earlier than the other.</p>
<p>The time a given number of seconds or milliseconds later than a given time can be found using the <a href="qtime.html#addSecs">addSecs</a>() or <a href="qtime.html#addMSecs">addMSecs</a>() functions. Correspondingly, the number of (milli)seconds between two times can be found using the <a href="qtime.html#secsTo">secsTo</a>() or <a href="qtime.html#msecsTo">msecsTo</a>() functions.</p>
<p>QTime can be used to measure a span of elapsed time using the <a href="qtime.html#start">start</a>(), <a href="qtime.html#restart">restart</a>(), and <a href="qtime.html#elapsed">elapsed</a>() functions.</p>
<p>See also <a href="qdate.html">QDate</a> and <a href="qdatetime.html">QDateTime</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QTime" />QTime.__init__ (<i>self</i>)</h3><p>Constructs a null time object.</p>
<p>See also <a href="qtime.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="QTime-2" />QTime.__init__ (<i>self</i>, int&#160;<i>h</i>, int&#160;<i>m</i>, int&#160;<i>s</i>&#160;=&#160;0, int&#160;<i>ms</i>&#160;=&#160;0)</h3><p>Constructs a time with hour <i>h</i>, minute <i>m</i>, seconds <i>s</i> and milliseconds <i>ms</i>.</p>
<p><i>h</i> must be in the range 0 to 23, <i>m</i> and <i>s</i> must be in the range 0 to 59, and <i>ms</i> must be in the range 0 to 999.</p>
<p>See also <a href="qtime.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="QTime-3" />QTime.__init__ (<i>self</i>, <a href="qtime.html">QTime</a>)</h3><h3 class="fn"><a name="addMSecs" /><a href="qtime.html">QTime</a> QTime.addMSecs (<i>self</i>, int&#160;<i>ms</i>)</h3><p>Returns a <a href="qtime.html">QTime</a> object containing a time <i>ms</i> milliseconds later than the time of this object (or earlier if <i>ms</i> is negative).</p>
<p>Note that the time will wrap if it passes midnight. See <a href="qtime.html#addSecs">addSecs</a>() for an example.</p>
<p>See also <a href="qtime.html#addSecs">addSecs</a>() and <a href="qtime.html#msecsTo">msecsTo</a>().</p>
<h3 class="fn"><a name="addSecs" /><a href="qtime.html">QTime</a> QTime.addSecs (<i>self</i>, int&#160;<i>secs</i>)</h3><p>Returns a <a href="qtime.html">QTime</a> object containing a time <i>nsecs</i> seconds later than the time of this object (or earlier if <i>nsecs</i> is negative).</p>
<p>Note that the time will wrap if it passes midnight.</p>
<p>Example:</p>
<pre>
    QTime n(14, 0, 0);                // n == 14:00:00
    QTime t;
    t = n.addSecs(70);                // t == 14:01:10
    t = n.addSecs(-70);               // t == 13:58:50
    t = n.addSecs(10 * 60 * 60 + 5);  // t == 00:00:05
    t = n.addSecs(-15 * 60 * 60);     // t == 23:00:00
</pre>
<p>See also <a href="qtime.html#addMSecs">addMSecs</a>(), <a href="qtime.html#secsTo">secsTo</a>(), and <a href="qdatetime.html#addSecs">QDateTime.addSecs</a>().</p>
<h3 class="fn"><a name="currentTime" /><a href="qtime.html">QTime</a> QTime.currentTime ()</h3><h3 class="fn"><a name="elapsed" />int QTime.elapsed (<i>self</i>)</h3><p>Returns the number of milliseconds that have elapsed since the last time <a href="qtime.html#start">start</a>() or <a href="qtime.html#restart">restart</a>() was called.</p>
<p>Note that the counter wraps to zero 24 hours after the last call to <a href="qtime.html#start">start</a>() or restart.</p>
<p>Note that the accuracy depends on the accuracy of the underlying operating system; not all systems provide 1-millisecond accuracy.</p>
<p><b>Warning:</b> If the system's clock setting has been changed since the last time <a href="qtime.html#start">start</a>() or <a href="qtime.html#restart">restart</a>() was called, the result is undefined. This can happen when daylight savings time is turned on or off.</p>
<p>See also <a href="qtime.html#start">start</a>() and <a href="qtime.html#restart">restart</a>().</p>
<h3 class="fn"><a name="fromString" /><a href="qtime.html">QTime</a> QTime.fromString (<a href="qstring.html">QString</a>&#160;<i>s</i>, <a href="qt.html#DateFormat-enum">Qt.DateFormat</a>&#160;<i>f</i>&#160;=&#160;Qt.TextDate)</h3><p>Returns the time represented in the <i>string</i> as a <a href="qtime.html">QTime</a> using the <i>format</i> given, or an invalid time if this is not possible.</p>
<p><b>Warning:</b> Note that <a href="qt.html#DateFormat-enum">Qt.LocalDate</a> cannot be used here.</p>
<h3 class="fn"><a name="fromString-2" /><a href="qtime.html">QTime</a> QTime.fromString (<a href="qstring.html">QString</a>&#160;<i>s</i>, <a href="qstring.html">QString</a>&#160;<i>format</i>)</h3><p>This is an overloaded member function, provided for convenience.</p>
<p>Returns the <a href="qtime.html">QTime</a> represented by the <i>string</i>, using the <i>format</i> given, or an invalid time if the string cannot be parsed.</p>
<p>These expressions may be used for the format:</p>
<table align="center" border="0" cellpadding="2" cellspacing="1">
<tr bgcolor="#A2C511" valign="top">
<th>Expression</th>
<th>Output</th>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>h</td>
<td>the hour without a leading zero (0 to 23 or 1 to 12 if AM/PM display)</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>hh</td>
<td>the hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display)</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>m</td>
<td>the minute without a leading zero (0 to 59)</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>mm</td>
<td>the minute with a leading zero (00 to 59)</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>s</td>
<td>the second whithout a leading zero (0 to 59)</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>ss</td>
<td>the second whith a leading zero (00 to 59)</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>z</td>
<td>the milliseconds without leading zeroes (0 to 999)</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>zzz</td>
<td>the milliseconds with leading zeroes (000 to 999)</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>AP</td>
<td>interpret as an AM/PM time. <i>AP</i> must be either "AM" or "PM".</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>ap</td>
<td>Interpret as an AM/PM time. <i>ap</i> must be either "am" or "pm".</td>
</tr>
</table>
<br />
<br />
<p>All other input characters will be treated as text. Any sequence of characters that are enclosed in single quotes will also be treated as text and not be used as an expression.</p>
<pre>
    QTime time = QTime.fromString("1mm12car00", "m'mm'hcarss");
    // time is 12:01.00
</pre>
<p>If the format is not satisfied an invalid <a href="qtime.html">QTime</a> is returned. Expressions that do not expect leading zeroes to be given (h, m, s and z) are greedy. This means that they will use two digits even if this puts them outside the range of accepted values and leaves too few digits for other sections. For example, the following string could have meant 00:07:10, but the m will grab two digits, resulting in an invalid time:</p>
<pre>
    QTime time = QTime.fromString("00:710", "hh:ms"); // invalid
</pre>
<p>Any field that is not represented in the format will be set to zero. For example:</p>
<pre>
    QTime time = QTime.fromString("1.30", "m.s");
    // time is 00:01:30.000
</pre>
<p><a href="qdatetime.html#toString">QDateTime.toString</a>() <a href="qtime.html#toString">QTime.toString</a>()</p>
<p>See also <a href="qdatetime.html#fromString">QDateTime.fromString</a>(), <a href="qdate.html#fromString">QDate.fromString</a>(), and <a href="qdate.html#toString">QDate.toString</a>().</p>
<h3 class="fn"><a name="hour" />int QTime.hour (<i>self</i>)</h3><p>Returns the hour part (0 to 23) of the time.</p>
<p>See also <a href="qtime.html#minute">minute</a>(), <a href="qtime.html#second">second</a>(), and <a href="qtime.html#msec">msec</a>().</p>
<h3 class="fn"><a name="isNull" />bool QTime.isNull (<i>self</i>)</h3><p>Returns true if the time is null; otherwise returns false. A null time is also an invalid time.</p>
<p>See also <a href="qtime.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="isValid" />bool QTime.isValid (<i>self</i>)</h3><p>Returns true if the time is valid; otherwise returns false. For example, the time 23:30:55.746 is valid, but 24:12:30 is invalid.</p>
<p>See also <a href="qtime.html#isNull">isNull</a>().</p>
<h3 class="fn"><a name="isValid-2" />bool QTime.isValid (int&#160;<i>h</i>, int&#160;<i>m</i>, int&#160;<i>s</i>, int&#160;<i>ms</i>&#160;=&#160;0)</h3><p>This is an overloaded member function, provided for convenience.</p>
<p>Returns true if the specified time is valid; otherwise returns false.</p>
<p>The time is valid if <i>h</i> is in the range 0 to 23, <i>m</i> and <i>s</i> are in the range 0 to 59, and <i>ms</i> is in the range 0 to 999.</p>
<p>Example:</p>
<pre>
    QTime.isValid(21, 10, 30); // returns true
    QTime.isValid(22, 5,  62); // returns false
</pre>
<h3 class="fn"><a name="minute" />int QTime.minute (<i>self</i>)</h3><p>Returns the minute part (0 to 59) of the time.</p>
<p>See also <a href="qtime.html#hour">hour</a>(), <a href="qtime.html#second">second</a>(), and <a href="qtime.html#msec">msec</a>().</p>
<h3 class="fn"><a name="msec" />int QTime.msec (<i>self</i>)</h3><p>Returns the millisecond part (0 to 999) of the time.</p>
<p>See also <a href="qtime.html#hour">hour</a>(), <a href="qtime.html#minute">minute</a>(), and <a href="qtime.html#second">second</a>().</p>
<h3 class="fn"><a name="msecsTo" />int QTime.msecsTo (<i>self</i>, <a href="qtime.html">QTime</a>)</h3><p>Returns the number of milliseconds from this time to <i>t</i>. If <i>t</i> is earlier than this time, the number of milliseconds returned is negative.</p>
<p>Because <a href="qtime.html">QTime</a> measures time within a day and there are 86400 seconds in a day, the result is always between -86400000 and 86400000 msec.</p>
<p>See also <a href="qtime.html#secsTo">secsTo</a>() and <a href="qtime.html#addMSecs">addMSecs</a>().</p>
<h3 class="fn"><a name="restart" />int QTime.restart (<i>self</i>)</h3><p>Sets this time to the current time and returns the number of milliseconds that have elapsed since the last time <a href="qtime.html#start">start</a>() or restart() was called.</p>
<p>This function is guaranteed to be atomic and is thus very handy for repeated measurements. Call <a href="qtime.html#start">start</a>() to start the first measurement, and restart() for each later measurement.</p>
<p>Note that the counter wraps to zero 24 hours after the last call to <a href="qtime.html#start">start</a>() or restart().</p>
<p><b>Warning:</b> If the system's clock setting has been changed since the last time <a href="qtime.html#start">start</a>() or restart() was called, the result is undefined. This can happen when daylight savings time is turned on or off.</p>
<p>See also <a href="qtime.html#start">start</a>(), <a href="qtime.html#elapsed">elapsed</a>(), and <a href="qtime-qt3.html#currentTime">currentTime</a>().</p>
<h3 class="fn"><a name="second" />int QTime.second (<i>self</i>)</h3><p>Returns the second part (0 to 59) of the time.</p>
<p>See also <a href="qtime.html#hour">hour</a>(), <a href="qtime.html#minute">minute</a>(), and <a href="qtime.html#msec">msec</a>().</p>
<h3 class="fn"><a name="secsTo" />int QTime.secsTo (<i>self</i>, <a href="qtime.html">QTime</a>)</h3><p>Returns the number of seconds from this time to <i>t</i>. If <i>t</i> is earlier than this time, the number of seconds returned is negative.</p>
<p>Because <a href="qtime.html">QTime</a> measures time within a day and there are 86400 seconds in a day, the result is always between -86400 and 86400.</p>
<p>See also <a href="qtime.html#addSecs">addSecs</a>() and <a href="qdatetime.html#secsTo">QDateTime.secsTo</a>().</p>
<h3 class="fn"><a name="setHMS" />bool QTime.setHMS (<i>self</i>, int&#160;<i>h</i>, int&#160;<i>m</i>, int&#160;<i>s</i>, int&#160;<i>ms</i>&#160;=&#160;0)</h3><p>Sets the time to hour <i>h</i>, minute <i>m</i>, seconds <i>s</i> and milliseconds <i>ms</i>.</p>
<p><i>h</i> must be in the range 0 to 23, <i>m</i> and <i>s</i> must be in the range 0 to 59, and <i>ms</i> must be in the range 0 to 999. Returns true if the set time is valid; otherwise returns false.</p>
<p>See also <a href="qtime.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="start" />QTime.start (<i>self</i>)</h3><p>Sets this time to the current time. This is practical for timing:</p>
<pre>
    QTime t;
    t.start();
    some_lengthy_task();
    qDebug("Time elapsed: %d ms", t.elapsed());
</pre>
<p>See also <a href="qtime.html#restart">restart</a>(), <a href="qtime.html#elapsed">elapsed</a>(), and <a href="qtime-qt3.html#currentTime">currentTime</a>().</p>
<h3 class="fn"><a name="toString" /><a href="qstring.html">QString</a> QTime.toString (<i>self</i>, <a href="qt.html#DateFormat-enum">Qt.DateFormat</a>&#160;<i>f</i>&#160;=&#160;Qt.TextDate)</h3><p>Returns the time as a string. The <i>format</i> parameter determines the format of the result string.</p>
<p>These expressions may be used:</p>
<table align="center" border="0" cellpadding="2" cellspacing="1">
<tr bgcolor="#A2C511" valign="top">
<th>Expression</th>
<th>Output</th>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>h</td>
<td>the hour without a leading zero (0 to 23 or 1 to 12 if AM/PM display)</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>hh</td>
<td>the hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display)</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>H</td>
<td>the hour without a leading zero (0 to 23, even with AM/PM display)</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>HH</td>
<td>the hour with a leading zero (00 to 23, even with AM/PM display)</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>m</td>
<td>the minute without a leading zero (0 to 59)</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>mm</td>
<td>the minute with a leading zero (00 to 59)</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>s</td>
<td>the second whithout a leading zero (0 to 59)</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>ss</td>
<td>the second whith a leading zero (00 to 59)</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>z</td>
<td>the milliseconds without leading zeroes (0 to 999)</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>zzz</td>
<td>the milliseconds with leading zeroes (000 to 999)</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>AP or A</td>
<td>use AM/PM display. <i>AP</i> will be replaced by either "AM" or "PM".</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>ap or a</td>
<td>use am/pm display. <i>ap</i> will be replaced by either "am" or "pm".</td>
</tr>
</table>
<br />
<br />
<p>All other input characters will be ignored. Any sequence of characters that are enclosed in singlequotes will be treated as text and not be used as an expression.</p>
<p>Example format strings (assuming that the <a href="qtime.html">QTime</a> is 14:13:09.042)</p>
<table align="center" border="0" cellpadding="2" cellspacing="1">
<tr bgcolor="#A2C511" valign="top">
<th>Format</th>
<th>Result</th>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>hh:mm:ss.zzz</td>
<td>14:13:09.042</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>h:m:s ap</td>
<td>2:13:9 pm</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>H:m:s a</td>
<td>14:13:9 pm</td>
</tr>
</table>
<br />
<br />
<p>If the datetime is invalid, an empty string will be returned.</p>
<p>See also <a href="qdate.html#toString">QDate.toString</a>() and <a href="qdatetime.html#toString">QDateTime.toString</a>().</p>
<h3 class="fn"><a name="toString-2" /><a href="qstring.html">QString</a> QTime.toString (<i>self</i>, <a href="qstring.html">QString</a>&#160;<i>format</i>)</h3><p>This is an overloaded member function, provided for convenience.</p>
<p>Returns the time as a string. Milliseconds are not included. The <i>f</i> parameter determines the format of the string.</p>
<p>If <i>f</i> is <a href="qt.html#DateFormat-enum">Qt.TextDate</a>, the string format is HH:MM:SS; e.g. 1 second before midnight would be "23:59:59".</p>
<p>If <i>f</i> is <a href="qt.html#DateFormat-enum">Qt.ISODate</a>, the string format corresponds to the ISO 8601 extended specification for representations of dates, which is also HH:MM:SS.</p>
<p>If <i>f</i> is <a href="qt.html#DateFormat-enum">Qt.LocalDate</a>, the string format depends on the locale settings of the system.</p>
<p>If the datetime is invalid, an empty string will be returned.</p>
<h3 class="fn"><a name="__eq__" />bool QTime.__eq__ (<i>self</i>, <a href="qtime.html">QTime</a>&#160;<i>other</i>)</h3><h3 class="fn"><a name="__ge__" />bool QTime.__ge__ (<i>self</i>, <a href="qtime.html">QTime</a>&#160;<i>other</i>)</h3><h3 class="fn"><a name="__gt__" />bool QTime.__gt__ (<i>self</i>, <a href="qtime.html">QTime</a>&#160;<i>other</i>)</h3><h3 class="fn"><a name="__le__" />bool QTime.__le__ (<i>self</i>, <a href="qtime.html">QTime</a>&#160;<i>other</i>)</h3><h3 class="fn"><a name="__lt__" />bool QTime.__lt__ (<i>self</i>, <a href="qtime.html">QTime</a>&#160;<i>other</i>)</h3><h3 class="fn"><a name="__ne__" />bool QTime.__ne__ (<i>self</i>, <a href="qtime.html">QTime</a>&#160;<i>other</i>)</h3><h3 class="fn"><a name="__nonzero__" />int QTime.__nonzero__ (<i>self</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td width="25%">PyQt&#160;4.0.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.trolltech.com">Trolltech&#160;AS</a> 2006</td><td align="right" width="25%">Qt&#160;4.1.4</td></tr></table></div></address></body></html>