This file is indexed.

/usr/share/qt5/doc/qtqml/qml-qtqml-date.html is in qtdeclarative5-doc-html 5.9.5-0ubuntu1.

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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- date.qdoc -->
  <title>Date QML Type | Qt QML 5.9</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.9</td><td ><a href="qtqml-index.html">Qt QML</a></td><td ><a href="qtqml-qmlmodule.html">QML Types</a></td><td >Date QML Type</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.5 Reference Documentation</td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<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>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Date QML Type</h1>
<span class="subtitle"></span>
<!-- $$$Date-brief -->
<p>Provides date functions <a href="#details">More...</a></p>
<!-- @@@Date -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import QtQml 2.2</td></tr></table></div><ul>
<li><a href="qml-qtqml-date-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="methods"></a>
<h2 id="methods">Methods</h2>
<ul>
<li class="fn">string <b><b><a href="qml-qtqml-date.html#fromLocaleDateString-method">fromLocaleDateString</a></b></b>(<i>locale</i>, <i>dateString</i>, <i>format</i>)</li>
<li class="fn">string <b><b><a href="qml-qtqml-date.html#fromLocaleString-method">fromLocaleString</a></b></b>(<i>locale</i>, <i>dateTimeString</i>, <i>format</i>)</li>
<li class="fn">string <b><b><a href="qml-qtqml-date.html#fromLocaleTimeString-method">fromLocaleTimeString</a></b></b>(<i>locale</i>, <i>timeString</i>, <i>format</i>)</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>(<i>locale</i>, <i>format</i>)</li>
<li class="fn">string <b><b><a href="qml-qtqml-date.html#toLocaleString-method">toLocaleString</a></b></b>(<i>locale</i>, <i>format</i>)</li>
<li class="fn">string <b><b><a href="qml-qtqml-date.html#toLocaleTimeString-method">toLocaleTimeString</a></b></b>(<i>locale</i>, <i>format</i>)</li>
</ul>
<!-- $$$Date-description -->
<a name="details"></a>
<h2 id="details">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>
<div class="table"><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></div>
<p>or a string specifying the format These expressions may be used for format dates:</p>
<div class="table"><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></div>
<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>
<div class="table"><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></div>
<p>These expressions may be used for formatting time:</p>
<div class="table"><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></div>
<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 <a href="../qtcore/qtime.html">QTime</a> is 14:13:09.042)</p>
<div class="table"><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></div>
<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>Note: There are different date formats with different understandings of negative years. Common human language does not have a year 0. The year after 1BC is 1AD. This understanding is reflected when printing or parsing dates in one of the formats not standardized by ECMAScript. That is: toString(), <a href="qml-qtqml-date.html#toLocaleString-method">toLocaleString()</a>, toUTCString() and friends. ECMAScript does standardize one format: ISO 8601. This is what you get when you call toISOString(). This format does include a year 0, which is 1BC in other formats. Thus you get different years when printing negative dates with toISOString() and toString().</p>
<p>When setting the year using the Date constructor or set(UTC)FullYear(), the convention set by ISO 8601 is used and 0 is a valid year. This means negative years set with the constructor or set(UTC)FullYear() are zero-based and thus offset by one year from what is printed with toString() and friends. Parsing the output of any of the to*String() methods will yield the same date value you printed from. Date.parse() will recognize the different formats and their convention on the existence of year 0.</p>
<p>Note that all this is different from what you get in other JavaScript implementations which usually treat year 0 as valid in all string representations. As the date formats are &quot;implementation-dependent&quot; in the ECMAScript standard, this is still valid, though.</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">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="fromLocaleDateString-method">
<td class="tblQmlFuncNode"><p>
<a name="fromLocaleDateString-method"></a><span class="type">string</span> <span class="name">fromLocaleDateString</span>(<i>locale</i>, <i>dateString</i>, <i>format</i>)</p></td></tr>
</table></div>
</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-qmlmodule.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">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="fromLocaleString-method">
<td class="tblQmlFuncNode"><p>
<a name="fromLocaleString-method"></a><span class="type">string</span> <span class="name">fromLocaleString</span>(<i>locale</i>, <i>dateTimeString</i>, <i>format</i>)</p></td></tr>
</table></div>
</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-qmlmodule.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">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="fromLocaleTimeString-method">
<td class="tblQmlFuncNode"><p>
<a name="fromLocaleTimeString-method"></a><span class="type">string</span> <span class="name">fromLocaleTimeString</span>(<i>locale</i>, <i>timeString</i>, <i>format</i>)</p></td></tr>
</table></div>
</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-qmlmodule.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">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="timeZoneUpdated-method">
<td class="tblQmlFuncNode"><p>
<a name="timeZoneUpdated-method"></a><span class="type">string</span> <span class="name">timeZoneUpdated</span>()</p></td></tr>
</table></div>
</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">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="toLocaleDateString-method">
<td class="tblQmlFuncNode"><p>
<a name="toLocaleDateString-method"></a><span class="type">string</span> <span class="name">toLocaleDateString</span>(<i>locale</i>, <i>format</i>)</p></td></tr>
</table></div>
</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> <span class="keyword">new</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">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="toLocaleString-method">
<td class="tblQmlFuncNode"><p>
<a name="toLocaleString-method"></a><span class="type">string</span> <span class="name">toLocaleString</span>(<i>locale</i>, <i>format</i>)</p></td></tr>
</table></div>
</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> <span class="keyword">new</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">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="toLocaleTimeString-method">
<td class="tblQmlFuncNode"><p>
<a name="toLocaleTimeString-method"></a><span class="type">string</span> <span class="name">toLocaleTimeString</span>(<i>locale</i>, <i>format</i>)</p></td></tr>
</table></div>
</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> <span class="keyword">new</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> 2017 The Qt Company Ltd.
   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>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>