This file is indexed.

/usr/share/qt5/doc/qtqml/qml-qtqml-date.html is in qtdeclarative5-doc-html 5.2.1-3ubuntu15.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- date.qdoc -->
  <title>Date | QtQml 5.2</title>
  <link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
    <div class="main">
    <div class="main-rounded">
        <div class="navigationbar">
        <ul>
<li>Qt 5.2</li>
<li><a href="qtqml-index.html">Qt QML</a></li>
<li><a href="qtqml-qmlmodule.html">QML Types</a></li>
<li>Date</li>
<li id="buildversion">
Qt 5.2.1 Reference Documentation</li>
    </ul>
    </div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#methods">Methods</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">Date</h1>
<span class="subtitle"></span>
<!-- $$$Date-brief -->
<p>Provides date functions <a href="#details">More...</a></p>
<!-- @@@Date -->
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> </b><tt>import QtQml 2.2</tt></td></tr></table><ul>
<li><a href="qml-qtqml-date-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="methods"></a>
<h2>Methods</h2>
<ul>
<li class="fn">string <b><b><a href="qml-qtqml-date.html#fromLocaleDateString-method">fromLocaleDateString</a></b></b>(locale, dateString, format)</li>
<li class="fn">string <b><b><a href="qml-qtqml-date.html#fromLocaleString-method">fromLocaleString</a></b></b>(locale, dateTimeString, format)</li>
<li class="fn">string <b><b><a href="qml-qtqml-date.html#fromLocaleTimeString-method">fromLocaleTimeString</a></b></b>(locale, timeString, format)</li>
<li class="fn">string <b><b><a href="qml-qtqml-date.html#timeZoneUpdated-method">timeZoneUpdated</a></b></b>()</li>
<li class="fn">string <b><b><a href="qml-qtqml-date.html#toLocaleDateString-method">toLocaleDateString</a></b></b>(locale, format)</li>
<li class="fn">string <b><b><a href="qml-qtqml-date.html#toLocaleString-method">toLocaleString</a></b></b>(locale, format)</li>
<li class="fn">string <b><b><a href="qml-qtqml-date.html#toLocaleTimeString-method">toLocaleTimeString</a></b></b>(locale, format)</li>
</ul>
<!-- $$$Date-description -->
<a name="details"></a>
<h2>Detailed Description</h2>
<p>The QML Date object extends the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date">JS Date object</a> with locale aware functions.</p>
<p>Functions that accept a locale format may be either an enumeration value:</p>
<table class="generic">
 <tr valign="top" class="odd"><td >Locale.LongFormat</td><td >The long version of the string; for example, returning &quot;January&quot; as a month name.</td></tr>
<tr valign="top" class="even"><td >Locale.ShortFormat</td><td >The short version of the string; for example, returning &quot;Jan&quot; as a month name.</td></tr>
<tr valign="top" class="odd"><td >Locale.NarrowFormat</td><td >A special version for use when space is limited; for example, returning &quot;J&quot; as a month name. Note that the narrow format might contain the same text for different months and days or it can even be an empty string if the locale doesn't support narrow names, so you should avoid using it for date formatting. Also, for the system locale this format is the same as ShortFormat.</td></tr>
</table>
<p>or a string specifying the format These expressions may be used for format dates:</p>
<table class="generic">
 <thead><tr class="qt-style"><th >Expression</th><th >Output</th></tr></thead>
<tr valign="top" class="odd"><td >d</td><td >the day as number without a leading zero (1 to 31)</td></tr>
<tr valign="top" class="even"><td >dd</td><td >the day as number with a leading zero (01 to 31)</td></tr>
<tr valign="top" class="odd"><td >ddd</td><td >the abbreviated localized day name (e.g&#x2e; 'Mon' to 'Sun').</td></tr>
<tr valign="top" class="even"><td >dddd</td><td >the long localized day name (e.g&#x2e; 'Monday' to 'Sunday').</td></tr>
<tr valign="top" class="odd"><td >M</td><td >the month as number without a leading zero (1 to 12)</td></tr>
<tr valign="top" class="even"><td >MM</td><td >the month as number with a leading zero (01 to 12)</td></tr>
<tr valign="top" class="odd"><td >MMM</td><td >the abbreviated localized month name (e.g&#x2e; 'Jan' to 'Dec').</td></tr>
<tr valign="top" class="even"><td >MMMM</td><td >the long localized month name (e.g&#x2e; 'January' to 'December').</td></tr>
<tr valign="top" class="odd"><td >yy</td><td >the year as two digit number (00 to 99)</td></tr>
<tr valign="top" class="even"><td >yyyy</td><td >the year as four digit number. If the year is negative, a minus sign is prepended in addition.</td></tr>
</table>
<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. Two consecutive singlequotes (&quot;''&quot;) are replaced by a singlequote in the output.</p>
<p>Example format strings (assuming that the Date is the 20 July 1969):</p>
<table class="generic">
 <thead><tr class="qt-style"><th >Format</th><th >Result</th></tr></thead>
<tr valign="top" class="odd"><td >dd.MM.yyyy</td><td >20.07.1969</td></tr>
<tr valign="top" class="even"><td >ddd MMMM d yy</td><td >Sun July 20 69</td></tr>
<tr valign="top" class="odd"><td >'The day is' dddd</td><td >The day is Sunday</td></tr>
</table>
<p>These expressions may be used for formatting time:</p>
<table class="generic">
 <thead><tr class="qt-style"><th >Expression</th><th >Output</th></tr></thead>
<tr valign="top" class="odd"><td >h</td><td >the hour without a leading zero (0 to 23 or 1 to 12 if AM/PM display)</td></tr>
<tr valign="top" class="even"><td >hh</td><td >the hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display)</td></tr>
<tr valign="top" class="odd"><td >H</td><td >the hour without a leading zero (0 to 23, even with AM/PM display)</td></tr>
<tr valign="top" class="even"><td >HH</td><td >the hour with a leading zero (00 to 23, even with AM/PM display)</td></tr>
<tr valign="top" class="odd"><td >m</td><td >the minute without a leading zero (0 to 59)</td></tr>
<tr valign="top" class="even"><td >mm</td><td >the minute with a leading zero (00 to 59)</td></tr>
<tr valign="top" class="odd"><td >s</td><td >the second without a leading zero (0 to 59)</td></tr>
<tr valign="top" class="even"><td >ss</td><td >the second with a leading zero (00 to 59)</td></tr>
<tr valign="top" class="odd"><td >z</td><td >the milliseconds without leading zeroes (0 to 999)</td></tr>
<tr valign="top" class="even"><td >zzz</td><td >the milliseconds with leading zeroes (000 to 999)</td></tr>
<tr valign="top" class="odd"><td >AP or A</td><td >use AM/PM display. <i>AP</i> will be replaced by either &quot;AM&quot; or &quot;PM&quot;.</td></tr>
<tr valign="top" class="even"><td >ap or a</td><td >use am/pm display. <i>ap</i> will be replaced by either &quot;am&quot; or &quot;pm&quot;.</td></tr>
<tr valign="top" class="odd"><td >t</td><td >the timezone (for example &quot;CEST&quot;)</td></tr>
</table>
<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. Two consecutive singlequotes (&quot;''&quot;) are replaced by a singlequote in the output.</p>
<p>Example format strings (assuming that the QTime is 14:13:09.042)</p>
<table class="generic">
 <thead><tr class="qt-style"><th >Format</th><th >Result</th></tr></thead>
<tr valign="top" class="odd"><td >hh:mm:ss.zzz</td><td >14:13:09.042</td></tr>
<tr valign="top" class="even"><td >h:m:s ap</td><td >2:13:9 pm</td></tr>
<tr valign="top" class="odd"><td >H:m:s a</td><td >14:13:9 pm</td></tr>
</table>
<p>If the date is invalid, an empty string will be returned.</p>
<p>Note: Using the locale-aware functions to perform date or time formatting can result in incorrectly formatted times, due to an inconsistency in specification between Qt and JS. ECMA-262 specifies that historical dates should be intrepreted by projecting the current rules for daylight-saving onto past years, while Qt uses historical data (where available) to determine whether daylight-saving was in effect for a given date. Therefore, constructing a Date value in JS and converting it to a string using the locale-aware functions can yield a result incorrect by one hour, if DST is currently in effect, while it was not for the time specified, or vice versa.</p>
<p><b>See also </b><a href="qml-qtqml-locale.html">Locale</a>.</p>
<!-- @@@Date -->
<h2>Method Documentation</h2>
<!-- $$$fromLocaleDateString -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="fromLocaleDateString-method"></a><span class="type"><a href="qml-string.html">string</a></span> <span class="name">fromLocaleDateString</span>(<span class="type">locale</span>, <span class="type">dateString</span>, <span class="type">format</span>)</p></td></tr></table></div><div class="qmldoc"><p>Converts the date string <i>dateString</i> to a <a href="qml-qtqml-date.html">Date</a> object using <i>locale</i> and <i>format</i>.</p>
<p>If <i>format</i> is not specified, <a href="qml-qtqml-locale.html">Locale.LongFormat</a> will be used.</p>
<p>If <i>locale</i> is not specified, the default locale will be used.</p>
<p>The following example shows the current date first being formatted as a date string using the default locale and format, then parsed back again in the same manner:</p>
<pre class="cpp">import <span class="type"><a href="qtqml-module.html">QtQml</a></span> <span class="number">2.0</span>

<span class="type"><a href="qml-qtqml-qtobject.html">QtObject</a></span> {
    property var locale: <span class="type"><a href="qml-qtqml-qt.html">Qt</a></span><span class="operator">.</span>locale()
    property date currentDate: <span class="keyword">new</span> Date()
    property string dateString

    Component<span class="operator">.</span>onCompleted: {
        dateString <span class="operator">=</span> currentDate<span class="operator">.</span>toLocaleDateString();
        print(Date<span class="operator">.</span>fromLocaleDateString(dateString));
    }
}</pre>
</div></div><!-- @@@fromLocaleDateString -->
<br/>
<!-- $$$fromLocaleString -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="fromLocaleString-method"></a><span class="type"><a href="qml-string.html">string</a></span> <span class="name">fromLocaleString</span>(<span class="type">locale</span>, <span class="type">dateTimeString</span>, <span class="type">format</span>)</p></td></tr></table></div><div class="qmldoc"><p>Converts the datetime string <i>dateTimeString</i> to a <a href="qml-qtqml-date.html">Date</a> object using <i>locale</i> and <i>format</i>.</p>
<p>If <i>format</i> is not specified, <a href="qml-qtqml-locale.html">Locale.LongFormat</a> will be used.</p>
<p>If <i>locale</i> is not specified, the default locale will be used.</p>
<p>The following example shows a datetime being parsed from a datetime string in a certain format using the default locale:</p>
<pre class="cpp">import <span class="type"><a href="qtqml-module.html">QtQml</a></span> <span class="number">2.0</span>

<span class="type"><a href="qml-qtqml-qtobject.html">QtObject</a></span> {
    property var locale: <span class="type"><a href="qml-qtqml-qt.html">Qt</a></span><span class="operator">.</span>locale()
    property string dateTimeString: <span class="string">&quot;Tue 2013-09-17 10:56:06&quot;</span>

    Component<span class="operator">.</span>onCompleted: {
        print(Date<span class="operator">.</span>fromLocaleString(locale<span class="operator">,</span> dateTimeString<span class="operator">,</span> <span class="string">&quot;ddd yyyy-MM-dd hh:mm:ss&quot;</span>));
    }
}</pre>
</div></div><!-- @@@fromLocaleString -->
<br/>
<!-- $$$fromLocaleTimeString -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="fromLocaleTimeString-method"></a><span class="type"><a href="qml-string.html">string</a></span> <span class="name">fromLocaleTimeString</span>(<span class="type">locale</span>, <span class="type">timeString</span>, <span class="type">format</span>)</p></td></tr></table></div><div class="qmldoc"><p>Converts the time string <i>timeString</i> to a <a href="qml-qtqml-date.html">Date</a> object using <i>locale</i> and <i>format</i>.</p>
<p>If <i>format</i> is not specified, <a href="qml-qtqml-locale.html">Locale.LongFormat</a> will be used.</p>
<p>If <i>locale</i> is not specified, the default locale will be used.</p>
<p>The following example shows the current time first being formatted as a time string using the default locale and a short format, then parsed back again in the same manner:</p>
<pre class="cpp">import <span class="type"><a href="qtqml-module.html">QtQml</a></span> <span class="number">2.2</span>

<span class="type"><a href="qml-qtqml-qtobject.html">QtObject</a></span> {
    property var locale: <span class="type"><a href="qml-qtqml-qt.html">Qt</a></span><span class="operator">.</span>locale()
    property date currentTime: <span class="keyword">new</span> Date()
    property string timeString

    Component<span class="operator">.</span>onCompleted: {
        timeString <span class="operator">=</span> currentTime<span class="operator">.</span>toLocaleTimeString(locale<span class="operator">,</span> Locale<span class="operator">.</span>ShortFormat);
        print(Date<span class="operator">.</span>fromLocaleTimeString(locale<span class="operator">,</span> timeString<span class="operator">,</span> Locale<span class="operator">.</span>ShortFormat));
    }
}</pre>
</div></div><!-- @@@fromLocaleTimeString -->
<br/>
<!-- $$$timeZoneUpdated -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="timeZoneUpdated-method"></a><span class="type"><a href="qml-string.html">string</a></span> <span class="name">timeZoneUpdated</span>()</p></td></tr></table></div><div class="qmldoc"><p>Informs the JS engine that the system's timezone has been changed, which is necessary for the correct manipulation of datetime data.</p>
<p>JS stores Date objects in UTC time; all access to and from Date components in local time involves the application of the current offset from UTC. If the current offset changes due to the timezone being updated, the JS engine needs to be informed so that it can recalculate the offset.</p>
<p>This function should be called after the system's timezone has been updated.</p>
<p>For example, an application that changes the timezone would call timeZoneUpdated() after setting the new time zone:</p>
<pre class="cpp">property string selectedTimeZone

onSelectedTimeZoneChanged: {
    MyFunctions<span class="operator">.</span>setSystemTimeZone(selectedTimeZone)
    Date<span class="operator">.</span>timeZoneUpdated()
}</pre>
</div></div><!-- @@@timeZoneUpdated -->
<br/>
<!-- $$$toLocaleDateString -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="toLocaleDateString-method"></a><span class="type"><a href="qml-string.html">string</a></span> <span class="name">toLocaleDateString</span>(<span class="type">locale</span>, <span class="type">format</span>)</p></td></tr></table></div><div class="qmldoc"><p>Converts the Date to a string containing the date suitable for the specified <i>locale</i> in the specified <i>format</i>.</p>
<p>If <i>format</i> is not specified, <a href="qml-qtqml-locale.html">Locale.LongFormat</a> will be used.</p>
<p>If <i>locale</i> is not specified, the default locale will be used.</p>
<p>The following example shows the current date formatted for the German locale:</p>
<pre class="cpp">import <span class="type">QtQuick</span> <span class="number">2.0</span>

Text {
    text: <span class="string">&quot;The date is: &quot;</span> <span class="operator">+</span>  Date()<span class="operator">.</span>toLocaleDateString(<span class="type"><a href="qml-qtqml-qt.html">Qt</a></span><span class="operator">.</span>locale(<span class="string">&quot;de_DE&quot;</span>))
}</pre>
</div></div><!-- @@@toLocaleDateString -->
<br/>
<!-- $$$toLocaleString -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="toLocaleString-method"></a><span class="type"><a href="qml-string.html">string</a></span> <span class="name">toLocaleString</span>(<span class="type">locale</span>, <span class="type">format</span>)</p></td></tr></table></div><div class="qmldoc"><p>Converts the Date to a string containing the date and time suitable for the specified <i>locale</i> in the specified <i>format</i>.</p>
<p>If <i>format</i> is not specified, <a href="qml-qtqml-locale.html">Locale.LongFormat</a> will be used.</p>
<p>If <i>locale</i> is not specified, the default locale will be used.</p>
<p>The following example shows the current date and time formatted for the German locale:</p>
<pre class="cpp">import <span class="type">QtQuick</span> <span class="number">2.0</span>

Text {
    text: <span class="string">&quot;The date is: &quot;</span> <span class="operator">+</span>  Date()<span class="operator">.</span>toLocaleString(<span class="type"><a href="qml-qtqml-qt.html">Qt</a></span><span class="operator">.</span>locale(<span class="string">&quot;de_DE&quot;</span>))
}</pre>
</div></div><!-- @@@toLocaleString -->
<br/>
<!-- $$$toLocaleTimeString -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="toLocaleTimeString-method"></a><span class="type"><a href="qml-string.html">string</a></span> <span class="name">toLocaleTimeString</span>(<span class="type">locale</span>, <span class="type">format</span>)</p></td></tr></table></div><div class="qmldoc"><p>Converts the Date to a string containing the time suitable for the specified <i>locale</i> in the specified <i>format</i>.</p>
<p>If <i>format</i> is not specified, <a href="qml-qtqml-locale.html">Locale.LongFormat</a> will be used.</p>
<p>If <i>locale</i> is not specified, the default locale will be used.</p>
<p>The following example shows the current time formatted for the German locale:</p>
<pre class="cpp">import <span class="type">QtQuick</span> <span class="number">2.0</span>

Text {
    text: <span class="string">&quot;The date is: &quot;</span> <span class="operator">+</span>  Date()<span class="operator">.</span>toLocaleTimeString(<span class="type"><a href="qml-qtqml-qt.html">Qt</a></span><span class="operator">.</span>locale(<span class="string">&quot;de_DE&quot;</span>))
}</pre>
</div></div><!-- @@@toLocaleTimeString -->
<br/>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2013 Digia Plc and/or its
   subsidiaries. Documentation contributions included herein are the copyrights of
   their respective owners.<br>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br>    Digia, Qt and their respective logos are trademarks of Digia Plc     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>