You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tqt3/doc/html/ntqdatetime.html

394 lines
24 KiB

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/tools/qdatetime.cpp:1861 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQDateTime Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
<a href="index.html">
<font color="#004faf">Home</font></a>
| <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
| <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQDateTime Class Reference</h1>
<p>The TQDateTime class provides date and time functions.
<a href="#details">More...</a>
<p>All the functions in this class are <a href="threads.html#reentrant">reentrant</a> when TQt is built with thread support.</p>
<p><tt>#include &lt;<a href="qdatetime-h.html">ntqdatetime.h</a>&gt;</tt>
<p><a href="qdatetime-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQDateTime"><b>TQDateTime</b></a> ()</li>
<li class=fn><a href="#TQDateTime-2"><b>TQDateTime</b></a> ( const&nbsp;TQDate&nbsp;&amp;&nbsp;date )</li>
<li class=fn><a href="#TQDateTime-3"><b>TQDateTime</b></a> ( const&nbsp;TQDate&nbsp;&amp;&nbsp;date, const&nbsp;TQTime&nbsp;&amp;&nbsp;time )</li>
<li class=fn>bool <a href="#isNull"><b>isNull</b></a> () const</li>
<li class=fn>bool <a href="#isValid"><b>isValid</b></a> () const</li>
<li class=fn>TQDate <a href="#date"><b>date</b></a> () const</li>
<li class=fn>TQTime <a href="#time"><b>time</b></a> () const</li>
<li class=fn>uint <a href="#toTime_t"><b>toTime_t</b></a> () const</li>
<li class=fn>void <a href="#setDate"><b>setDate</b></a> ( const&nbsp;TQDate&nbsp;&amp;&nbsp;date )</li>
<li class=fn>void <a href="#setTime"><b>setTime</b></a> ( const&nbsp;TQTime&nbsp;&amp;&nbsp;time )</li>
<li class=fn>void <a href="#setTime_t-2"><b>setTime_t</b></a> ( uint&nbsp;secsSince1Jan1970UTC )</li>
<li class=fn>void <a href="#setTime_t"><b>setTime_t</b></a> ( uint&nbsp;secsSince1Jan1970UTC, TQt::TimeSpec&nbsp;ts )</li>
<li class=fn>TQString <a href="#toString-2"><b>toString</b></a> ( TQt::DateFormat&nbsp;f = TQt::TextDate ) const</li>
<li class=fn>TQString <a href="#toString"><b>toString</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;format ) const</li>
<li class=fn>TQDateTime <a href="#addDays"><b>addDays</b></a> ( int&nbsp;ndays ) const</li>
<li class=fn>TQDateTime <a href="#addMonths"><b>addMonths</b></a> ( int&nbsp;nmonths ) const</li>
<li class=fn>TQDateTime <a href="#addYears"><b>addYears</b></a> ( int&nbsp;nyears ) const</li>
<li class=fn>TQDateTime <a href="#addSecs"><b>addSecs</b></a> ( int&nbsp;nsecs ) const</li>
<li class=fn>int <a href="#daysTo"><b>daysTo</b></a> ( const&nbsp;TQDateTime&nbsp;&amp;&nbsp;dt ) const</li>
<li class=fn>int <a href="#secsTo"><b>secsTo</b></a> ( const&nbsp;TQDateTime&nbsp;&amp;&nbsp;dt ) const</li>
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const&nbsp;TQDateTime&nbsp;&amp;&nbsp;dt ) const</li>
<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const&nbsp;TQDateTime&nbsp;&amp;&nbsp;dt ) const</li>
<li class=fn>bool <a href="#operator-lt"><b>operator&lt;</b></a> ( const&nbsp;TQDateTime&nbsp;&amp;&nbsp;dt ) const</li>
<li class=fn>bool <a href="#operator-lt-eq"><b>operator&lt;=</b></a> ( const&nbsp;TQDateTime&nbsp;&amp;&nbsp;dt ) const</li>
<li class=fn>bool <a href="#operator-gt"><b>operator&gt;</b></a> ( const&nbsp;TQDateTime&nbsp;&amp;&nbsp;dt ) const</li>
<li class=fn>bool <a href="#operator-gt-eq"><b>operator&gt;=</b></a> ( const&nbsp;TQDateTime&nbsp;&amp;&nbsp;dt ) const</li>
</ul>
<h2>Static Public Members</h2>
<ul>
<li class=fn>TQDateTime <a href="#currentDateTime-2"><b>currentDateTime</b></a> ()</li>
<li class=fn>TQDateTime <a href="#currentDateTime"><b>currentDateTime</b></a> ( TQt::TimeSpec&nbsp;ts )</li>
<li class=fn>TQDateTime <a href="#fromString"><b>fromString</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;s, TQt::DateFormat&nbsp;f = TQt::TextDate )</li>
</ul>
<h2>Related Functions</h2>
<ul>
<li class=fn>TQDataStream &amp; <a href="#operator-lt-lt"><b>operator&lt;&lt;</b></a> ( TQDataStream&nbsp;&amp;&nbsp;s, const&nbsp;TQDateTime&nbsp;&amp;&nbsp;dt )</li>
<li class=fn>TQDataStream &amp; <a href="#operator-gt-gt"><b>operator&gt;&gt;</b></a> ( TQDataStream&nbsp;&amp;&nbsp;s, TQDateTime&nbsp;&amp;&nbsp;dt )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The TQDateTime class provides date and time functions.
<p>
<p> A TQDateTime object contains a calendar date and a clock time (a
"datetime"). It is a combination of the <a href="qdate.html">TQDate</a> and <a href="qtime.html">TQTime</a> classes.
It can read the current datetime from the system clock. It
provides functions for comparing datetimes and for manipulating a
datetime by adding a number of seconds, days, months or years.
<p> A TQDateTime object is typically created either by giving a date
and time explicitly in the constructor, or by using the static
function <a href="#currentDateTime">currentDateTime</a>(), which returns a TQDateTime object set
to the system clock's time. The date and time can be changed with
<a href="#setDate">setDate</a>() and <a href="#setTime">setTime</a>(). A datetime can also be set using the
<a href="#setTime_t">setTime_t</a>() function, which takes a POSIX-standard "number of
seconds since 00:00:00 on January 1, 1970" value. The <a href="#fromString">fromString</a>()
function returns a TQDateTime given a string and a date format
which is used to interpret the date within the string.
<p> The <a href="#date">date</a>() and <a href="#time">time</a>() functions provide access to the date and
time parts of the datetime. The same information is provided in
textual format by the <a href="#toString">toString</a>() function.
<p> TQDateTime provides a full set of operators to compare two
TQDateTime objects where smaller means earlier and larger means
later.
<p> You can increment (or decrement) a datetime by a given number of
seconds using <a href="#addSecs">addSecs</a>() or days using <a href="#addDays">addDays</a>(). Similarly you can
use <a href="#addMonths">addMonths</a>() and <a href="#addYears">addYears</a>(). The <a href="#daysTo">daysTo</a>() function returns the
number of days between two datetimes, and <a href="#secsTo">secsTo</a>() returns the
number of seconds between two datetimes.
<p> The range of a datetime object is constrained to the ranges of the
<a href="qdate.html">TQDate</a> and <a href="qtime.html">TQTime</a> objects which it embodies.
<p> <p>See also <a href="qdate.html">TQDate</a>, <a href="qtime.html">TQTime</a>, <a href="ntqdatetimeedit.html">TQDateTimeEdit</a>, and <a href="time.html">Time and Date</a>.
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQDateTime"></a>TQDateTime::TQDateTime ()
</h3>
<p> Constructs a null datetime (i.e. null date and null time). A null
datetime is invalid, since the date is invalid.
<p> <p>See also <a href="#isValid">isValid</a>().
<h3 class=fn><a name="TQDateTime-2"></a>TQDateTime::TQDateTime ( const&nbsp;<a href="qdate.html">TQDate</a>&nbsp;&amp;&nbsp;date )
</h3>
Constructs a datetime with date <em>date</em> and null (but valid) time
(00:00:00.000).
<h3 class=fn><a name="TQDateTime-3"></a>TQDateTime::TQDateTime ( const&nbsp;<a href="qdate.html">TQDate</a>&nbsp;&amp;&nbsp;date, const&nbsp;<a href="qtime.html">TQTime</a>&nbsp;&amp;&nbsp;time )
</h3>
Constructs a datetime with date <em>date</em> and time <em>time</em>.
<h3 class=fn><a href="ntqdatetime.html">TQDateTime</a> <a name="addDays"></a>TQDateTime::addDays ( int&nbsp;ndays ) const
</h3>
Returns a TQDateTime object containing a datetime <em>ndays</em> days
later than the datetime of this object (or earlier if <em>ndays</em> is
negative).
<p> <p>See also <a href="#daysTo">daysTo</a>(), <a href="#addMonths">addMonths</a>(), <a href="#addYears">addYears</a>(), and <a href="#addSecs">addSecs</a>().
<h3 class=fn><a href="ntqdatetime.html">TQDateTime</a> <a name="addMonths"></a>TQDateTime::addMonths ( int&nbsp;nmonths ) const
</h3>
Returns a TQDateTime object containing a datetime <em>nmonths</em> months
later than the datetime of this object (or earlier if <em>nmonths</em>
is negative).
<p> <p>See also <a href="#daysTo">daysTo</a>(), <a href="#addDays">addDays</a>(), <a href="#addYears">addYears</a>(), and <a href="#addSecs">addSecs</a>().
<h3 class=fn><a href="ntqdatetime.html">TQDateTime</a> <a name="addSecs"></a>TQDateTime::addSecs ( int&nbsp;nsecs ) const
</h3>
Returns a TQDateTime object containing a datetime <em>nsecs</em> seconds
later than the datetime of this object (or earlier if <em>nsecs</em> is
negative).
<p> <p>See also <a href="#secsTo">secsTo</a>(), <a href="#addDays">addDays</a>(), <a href="#addMonths">addMonths</a>(), and <a href="#addYears">addYears</a>().
<p>Example: <a href="listviews-example.html#x136">listviews/listviews.cpp</a>.
<h3 class=fn><a href="ntqdatetime.html">TQDateTime</a> <a name="addYears"></a>TQDateTime::addYears ( int&nbsp;nyears ) const
</h3>
Returns a TQDateTime object containing a datetime <em>nyears</em> years
later than the datetime of this object (or earlier if <em>nyears</em> is
negative).
<p> <p>See also <a href="#daysTo">daysTo</a>(), <a href="#addDays">addDays</a>(), <a href="#addMonths">addMonths</a>(), and <a href="#addSecs">addSecs</a>().
<h3 class=fn><a href="ntqdatetime.html">TQDateTime</a> <a name="currentDateTime"></a>TQDateTime::currentDateTime ( <a href="ntqt.html#TimeSpec-enum">TQt::TimeSpec</a>&nbsp;ts )<tt> [static]</tt>
</h3>
Returns the current datetime, as reported by the system clock, for the
TimeSpec <em>ts</em>. The default TimeSpec is LocalTime.
<p> <p>See also <a href="qdate.html#currentDate">TQDate::currentDate</a>(), <a href="qtime.html#currentTime">TQTime::currentTime</a>(), and <a href="ntqt.html#TimeSpec-enum">TQt::TimeSpec</a>.
<p>Example: <a href="listviews-example.html#x137">listviews/listviews.cpp</a>.
<h3 class=fn><a href="ntqdatetime.html">TQDateTime</a> <a name="currentDateTime-2"></a>TQDateTime::currentDateTime ()<tt> [static]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns the current datetime, as reported by the system clock.
<p> <p>See also <a href="qdate.html#currentDate">TQDate::currentDate</a>() and <a href="qtime.html#currentTime">TQTime::currentTime</a>().
<h3 class=fn><a href="qdate.html">TQDate</a> <a name="date"></a>TQDateTime::date () const
</h3>
<p> Returns the date part of the datetime.
<p> <p>See also <a href="#setDate">setDate</a>() and <a href="#time">time</a>().
<h3 class=fn>int <a name="daysTo"></a>TQDateTime::daysTo ( const&nbsp;<a href="ntqdatetime.html">TQDateTime</a>&nbsp;&amp;&nbsp;dt ) const
</h3>
Returns the number of days from this datetime to <em>dt</em> (which is
negative if <em>dt</em> is earlier than this datetime).
<p> <p>See also <a href="#addDays">addDays</a>() and <a href="#secsTo">secsTo</a>().
<h3 class=fn><a href="ntqdatetime.html">TQDateTime</a> <a name="fromString"></a>TQDateTime::fromString ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;s, <a href="ntqt.html#DateFormat-enum">TQt::DateFormat</a>&nbsp;f = TQt::TextDate )<tt> [static]</tt>
</h3>
Returns the TQDateTime represented by the string <em>s</em>, using the
format <em>f</em>, or an invalid datetime if this is not possible.
<p> Note for <a href="ntqt.html#DateFormat-enum">TQt::TextDate</a>: It is recommended that you use the
English short month names (e.g. "Jan"). Although localized month
names can also be used, they depend on the user's locale settings.
<p> <b>Warning:</b> Note that <a href="ntqt.html#DateFormat-enum">TQt::LocalDate</a> cannot be used here.
<h3 class=fn>bool <a name="isNull"></a>TQDateTime::isNull () const
</h3>
<p> Returns TRUE if both the date and the time are null; otherwise
returns FALSE. A null datetime is invalid.
<p> <p>See also <a href="qdate.html#isNull">TQDate::isNull</a>() and <a href="qtime.html#isNull">TQTime::isNull</a>().
<h3 class=fn>bool <a name="isValid"></a>TQDateTime::isValid () const
</h3>
<p> Returns TRUE if both the date and the time are valid; otherwise
returns FALSE.
<p> <p>See also <a href="qdate.html#isValid">TQDate::isValid</a>() and <a href="qtime.html#isValid">TQTime::isValid</a>().
<h3 class=fn>bool <a name="operator!-eq"></a>TQDateTime::operator!= ( const&nbsp;<a href="ntqdatetime.html">TQDateTime</a>&nbsp;&amp;&nbsp;dt ) const
</h3>
Returns TRUE if this datetime is different from <em>dt</em>; otherwise
returns FALSE.
<p> <p>See also <a href="#operator-eq-eq">operator==</a>().
<h3 class=fn>bool <a name="operator-lt"></a>TQDateTime::operator&lt; ( const&nbsp;<a href="ntqdatetime.html">TQDateTime</a>&nbsp;&amp;&nbsp;dt ) const
</h3>
Returns TRUE if this datetime is earlier than <em>dt</em>; otherwise
returns FALSE.
<h3 class=fn>bool <a name="operator-lt-eq"></a>TQDateTime::operator&lt;= ( const&nbsp;<a href="ntqdatetime.html">TQDateTime</a>&nbsp;&amp;&nbsp;dt ) const
</h3>
Returns TRUE if this datetime is earlier than or equal to <em>dt</em>;
otherwise returns FALSE.
<h3 class=fn>bool <a name="operator-eq-eq"></a>TQDateTime::operator== ( const&nbsp;<a href="ntqdatetime.html">TQDateTime</a>&nbsp;&amp;&nbsp;dt ) const
</h3>
Returns TRUE if this datetime is equal to <em>dt</em>; otherwise returns FALSE.
<p> <p>See also <a href="#operator!-eq">operator!=</a>().
<h3 class=fn>bool <a name="operator-gt"></a>TQDateTime::operator&gt; ( const&nbsp;<a href="ntqdatetime.html">TQDateTime</a>&nbsp;&amp;&nbsp;dt ) const
</h3>
Returns TRUE if this datetime is later than <em>dt</em>; otherwise
returns FALSE.
<h3 class=fn>bool <a name="operator-gt-eq"></a>TQDateTime::operator&gt;= ( const&nbsp;<a href="ntqdatetime.html">TQDateTime</a>&nbsp;&amp;&nbsp;dt ) const
</h3>
Returns TRUE if this datetime is later than or equal to <em>dt</em>;
otherwise returns FALSE.
<h3 class=fn>int <a name="secsTo"></a>TQDateTime::secsTo ( const&nbsp;<a href="ntqdatetime.html">TQDateTime</a>&nbsp;&amp;&nbsp;dt ) const
</h3>
Returns the number of seconds from this datetime to <em>dt</em> (which
is negative if <em>dt</em> is earlier than this datetime).
<p> Example:
<pre>
TQDateTime dt = TQDateTime::<a href="#currentDateTime">currentDateTime</a>();
TQDateTime xmas( TQDate(dt.<a href="#date">date</a>().year(),12,24), TQTime(17,00) );
<a href="ntqapplication.html#qDebug">tqDebug</a>( "There are %d seconds to Christmas", dt.<a href="#secsTo">secsTo</a>(xmas) );
</pre>
<p> <p>See also <a href="#addSecs">addSecs</a>(), <a href="#daysTo">daysTo</a>(), and <a href="qtime.html#secsTo">TQTime::secsTo</a>().
<h3 class=fn>void <a name="setDate"></a>TQDateTime::setDate ( const&nbsp;<a href="qdate.html">TQDate</a>&nbsp;&amp;&nbsp;date )
</h3>
<p> Sets the date part of this datetime to <em>date</em>.
<p> <p>See also <a href="#date">date</a>() and <a href="#setTime">setTime</a>().
<h3 class=fn>void <a name="setTime"></a>TQDateTime::setTime ( const&nbsp;<a href="qtime.html">TQTime</a>&nbsp;&amp;&nbsp;time )
</h3>
<p> Sets the time part of this datetime to <em>time</em>.
<p> <p>See also <a href="#time">time</a>() and <a href="#setDate">setDate</a>().
<h3 class=fn>void <a name="setTime_t"></a>TQDateTime::setTime_t ( uint&nbsp;secsSince1Jan1970UTC, <a href="ntqt.html#TimeSpec-enum">TQt::TimeSpec</a>&nbsp;ts )
</h3>
Sets the date and time to <em>ts</em> time (<a href="ntqt.html#TimeSpec-enum">TQt::LocalTime</a> or <a href="ntqt.html#TimeSpec-enum">TQt::UTC</a>) given the number of seconds that have passed since
1970-01-01T00:00:00, Coordinated Universal Time (UTC). On systems
that do not support timezones this function will behave as if
local time were UTC.
<p> On Windows, only a subset of <em>secsSince1Jan1970UTC</em> values are
supported, as Windows starts counting from 1980.
<p> <p>See also <a href="#toTime_t">toTime_t</a>().
<h3 class=fn>void <a name="setTime_t-2"></a>TQDateTime::setTime_t ( uint&nbsp;secsSince1Jan1970UTC )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Convenience function that sets the date and time to local time
based on the given UTC time.
<h3 class=fn><a href="qtime.html">TQTime</a> <a name="time"></a>TQDateTime::time () const
</h3>
<p> Returns the time part of the datetime.
<p> <p>See also <a href="#setTime">setTime</a>() and <a href="#date">date</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="toString"></a>TQDateTime::toString ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;format ) const
</h3>
Returns the datetime as a string. The <em>format</em> parameter
determines the format of the result string.
<p> These expressions may be used for the date:
<p> <center><table cellpadding="4" cellspacing="2" border="0">
<tr bgcolor="#a2c511"> <th valign="top">Expression <th valign="top">Output
<tr bgcolor="#f0f0f0"> <td valign="top">d <td valign="top">the day as number without a leading zero (1-31)
<tr bgcolor="#d0d0d0"> <td valign="top">dd <td valign="top">the day as number with a leading zero (01-31)
<tr bgcolor="#f0f0f0"> <td valign="top">ddd
<td valign="top">the abbreviated localized day name (e.g. 'Mon'..'Sun').
Uses <a href="qdate.html#shortDayName">TQDate::shortDayName</a>().
<tr bgcolor="#d0d0d0"> <td valign="top">dddd
<td valign="top">the long localized day name (e.g. 'Monday'..'Sunday').
Uses <a href="qdate.html#longDayName">TQDate::longDayName</a>().
<tr bgcolor="#f0f0f0"> <td valign="top">M <td valign="top">the month as number without a leading zero (1-12)
<tr bgcolor="#d0d0d0"> <td valign="top">MM <td valign="top">the month as number with a leading zero (01-12)
<tr bgcolor="#f0f0f0"> <td valign="top">MMM
<td valign="top">the abbreviated localized month name (e.g. 'Jan'..'Dec').
Uses <a href="qdate.html#shortMonthName">TQDate::shortMonthName</a>().
<tr bgcolor="#d0d0d0"> <td valign="top">MMMM
<td valign="top">the long localized month name (e.g. 'January'..'December').
Uses <a href="qdate.html#longMonthName">TQDate::longMonthName</a>().
<tr bgcolor="#f0f0f0"> <td valign="top">yy <td valign="top">the year as two digit number (00-99)
<tr bgcolor="#d0d0d0"> <td valign="top">yyyy <td valign="top">the year as four digit number (1752-8000)
</table></center>
<p> These expressions may be used for the time:
<p> <center><table cellpadding="4" cellspacing="2" border="0">
<tr bgcolor="#a2c511"> <th valign="top">Expression <th valign="top">Output
<tr bgcolor="#f0f0f0"> <td valign="top">h
<td valign="top">the hour without a leading zero (0..23 or 1..12 if AM/PM display)
<tr bgcolor="#d0d0d0"> <td valign="top">hh
<td valign="top">the hour with a leading zero (00..23 or 01..12 if AM/PM display)
<tr bgcolor="#f0f0f0"> <td valign="top">m <td valign="top">the minute without a leading zero (0..59)
<tr bgcolor="#d0d0d0"> <td valign="top">mm <td valign="top">the minute with a leading zero (00..59)
<tr bgcolor="#f0f0f0"> <td valign="top">s <td valign="top">the second whithout a leading zero (0..59)
<tr bgcolor="#d0d0d0"> <td valign="top">ss <td valign="top">the second whith a leading zero (00..59)
<tr bgcolor="#f0f0f0"> <td valign="top">z <td valign="top">the milliseconds without leading zeroes (0..999)
<tr bgcolor="#d0d0d0"> <td valign="top">zzz <td valign="top">the milliseconds with leading zeroes (000..999)
<tr bgcolor="#f0f0f0"> <td valign="top">AP
<td valign="top">use AM/PM display. <em>AP</em> will be replaced by either "AM" or "PM".
<tr bgcolor="#d0d0d0"> <td valign="top">ap
<td valign="top">use am/pm display. <em>ap</em> will be replaced by either "am" or "pm".
</table></center>
<p> All other input characters will be ignored.
<p> Example format strings (assumed that the TQDateTime is
21<small><sup>st</sup></small> May 2001 14:13:09)
<p> <center><table cellpadding="4" cellspacing="2" border="0">
<tr bgcolor="#a2c511"> <th valign="top">Format <th valign="top">Result
<tr bgcolor="#f0f0f0"> <td valign="top">dd.MM.yyyy <td valign="top" colspan="1" rowspan="1"> 21.05.2001
<tr bgcolor="#d0d0d0"> <td valign="top">ddd MMMM d yy <td valign="top" colspan="1" rowspan="1"> Tue May 21 01
<tr bgcolor="#f0f0f0"> <td valign="top">hh:mm:ss.zzz <td valign="top" colspan="1" rowspan="1"> 14:13:09.042
<tr bgcolor="#d0d0d0"> <td valign="top">h:m:s ap <td valign="top" colspan="1" rowspan="1"> 2:13:9 pm
</table></center>
<p> If the datetime is an invalid datetime, then <a href="ntqstring.html#TQString-null">TQString::null</a> will be returned.
<p> <p>See also <a href="qdate.html#toString">TQDate::toString</a>() and <a href="qtime.html#toString">TQTime::toString</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="toString-2"></a>TQDateTime::toString ( <a href="ntqt.html#DateFormat-enum">TQt::DateFormat</a>&nbsp;f = TQt::TextDate ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns the datetime as a string. The <em>f</em> parameter determines
the format of the string.
<p> If <em>f</em> is <a href="ntqt.html#DateFormat-enum">TQt::TextDate</a>, the string format is "Wed May 20
03:40:13 1998" (using <a href="qdate.html#shortDayName">TQDate::shortDayName</a>(), <a href="qdate.html#shortMonthName">TQDate::shortMonthName</a>(),
and <a href="qtime.html#toString">TQTime::toString</a>() to generate the string, so the day and month
names will have localized names).
<p> If <em>f</em> is <a href="ntqt.html#DateFormat-enum">TQt::ISODate</a>, the string format corresponds to the
ISO 8601 extended specification for representations of dates and
times, which is YYYY-MM-DDTHH:MM:SS.
<p> If <em>f</em> is <a href="ntqt.html#DateFormat-enum">TQt::LocalDate</a>, the string format depends on the
locale settings of the system.
<p> If the format <em>f</em> is invalid or the datetime is invalid, <a href="#toString">toString</a>()
returns a null string.
<p> <p>See also <a href="qdate.html#toString">TQDate::toString</a>() and <a href="qtime.html#toString">TQTime::toString</a>().
<h3 class=fn>uint <a name="toTime_t"></a>TQDateTime::toTime_t () const
</h3>
Returns the datetime as the number of seconds that have passed
since 1970-01-01T00:00:00, Coordinated Universal Time (UTC).
<p> On systems that do not support timezones, this function will
behave as if local time were UTC.
<p> <p>See also <a href="#setTime_t">setTime_t</a>().
<hr><h2>Related Functions</h2>
<h3 class=fn><a href="ntqdatastream.html">TQDataStream</a>&nbsp;&amp; <a name="operator-lt-lt"></a>operator&lt;&lt; ( <a href="ntqdatastream.html">TQDataStream</a>&nbsp;&amp;&nbsp;s, const&nbsp;<a href="ntqdatetime.html">TQDateTime</a>&nbsp;&amp;&nbsp;dt )
</h3>
<p> Writes the datetime <em>dt</em> to the stream <em>s</em>.
<p> <p>See also <a href="datastreamformat.html">Format of the TQDataStream operators</a>.
<h3 class=fn><a href="ntqdatastream.html">TQDataStream</a>&nbsp;&amp; <a name="operator-gt-gt"></a>operator&gt;&gt; ( <a href="ntqdatastream.html">TQDataStream</a>&nbsp;&amp;&nbsp;s, <a href="ntqdatetime.html">TQDateTime</a>&nbsp;&amp;&nbsp;dt )
</h3>
<p> Reads a datetime from the stream <em>s</em> into <em>dt</em>.
<p> <p>See also <a href="datastreamformat.html">Format of the TQDataStream operators</a>.
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright &copy; 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>