~ubuntu-branches/ubuntu/precise/sqlite3/precise-updates

« back to all changes in this revision

Viewing changes to www/lang_datefunc.html

  • Committer: Bazaar Package Importer
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2009-12-11 14:34:09 UTC
  • mfrom: (9.1.7 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091211143409-o29fahwmcmyd0vq1
Tags: 3.6.21-2
Run autoreconf to prevent FTBFS with new libtool (closes: #560660).

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
<style type="text/css">
5
5
body {
6
6
    margin: auto;
7
 
    font-family: "Verdana" "sans-serif";
 
7
    font-family: Verdana, sans-serif;
8
8
    padding: 8px 1%;
9
9
}
10
10
 
16
16
  float:right;
17
17
  text-align:right;
18
18
  font-style:italic;
19
 
  width:240px;
 
19
  width:300px;
20
20
  margin:12px;
21
21
  margin-top:58px;
22
22
}
43
43
.ne  { background: url(images/ne.png) 100% 0% no-repeat }
44
44
.nw  { background: url(images/nw.png) 0% 0% no-repeat }
45
45
 
 
46
/* Things for "fancyformat" documents start here. */
 
47
.fancy .codeblock i { color: darkblue; }
 
48
.fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#80a796}
 
49
.fancy h2 { margin-left: 10px }
 
50
.fancy h3 { margin-left: 20px }
 
51
.fancy h4 { margin-left: 30px }
 
52
.fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444}
 
53
.fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top}
 
54
.fancy #toc a        { color: darkblue ; text-decoration: none }
 
55
.fancy .todo         { color: #AA3333 ; font-style : italic }
 
56
.fancy .todo:before  { content: 'TODO:' }
 
57
.fancy p.todo        { border: solid #AA3333 1px; padding: 1ex }
 
58
.fancy img { display:block; }
 
59
.fancy :link:hover, .fancy :visited:hover { background: wheat }
 
60
.fancy p,.fancy ul,.fancy ol { margin: 1em 5ex }
 
61
.fancy li p { margin: 1em 0 }
 
62
/* End of "fancyformat" specific rules. */
 
63
 
46
64
</style>
47
65
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
48
66
  
65
83
    <a href="download.html">Download</a>
66
84
    <a href="copyright.html">License</a>
67
85
    <a href="news.html">News</a>
68
 
    <a href="http://www.sqlite.org/cvstrac/index">Developers</a>
 
86
    <!-- <a href="dev.html">Developers</a> -->
69
87
    <a href="support.html">Support</a>
70
88
  </div></div></div></div></div>
71
89
</td></tr></table>
72
90
  
73
 
<a href="lang.html">
74
 
           <h2 align="center">SQL As Understood By SQLite</h2></a><h1>Date And Time Functions</h1>
 
91
<h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>Date And Time Functions</h2>
75
92
 
76
93
<p>
77
94
SQLite supports five date and time functions as follows:
93
110
</p>
94
111
 
95
112
<p>
 
113
The date and time functions use a subset of
 
114
<a href="http://en.wikipedia.org/wiki/ISO_8601">IS0-8601</a> date and time
 
115
formats.
96
116
The date() function returns the date in this format: YYYY-MM-DD. 
97
117
The time() function returns the time as HH:MM:SS. 
98
118
The datetime() function returns "YYYY-MM-DD HH:MM:SS". 
99
119
The julianday() function returns the 
100
 
<a href="http://en.wikipedia.org/wiki/Julian_day">Julian day</a> - 
 
120
<a href="http://en.wikipedia.org/wiki/Julian_day">Julian day</a> - the
101
121
number of days since noon in Greenwich on November 24, 4714 B.C. 
102
 
(<a href="http://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar">Proleptic
103
 
Gregorian calendar</a>). 
 
122
(<a href="http://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar">Proleptic Gregorian calendar</a>). 
104
123
The strftime() routine returns the date formatted according to 
105
124
the format string specified as the first argument.
106
125
The format string supports the most common substitutions found in the 
107
 
<a href="http://opengroup.org/onlinepubs/007908799/xsh/strftime.html">
108
 
strftime() function</a> from 
109
 
the standard C library plus two new substitutions, %f and %J.
 
126
<a href="http://opengroup.org/onlinepubs/007908799/xsh/strftime.html">strftime() function</a>
 
127
from the standard C library plus two new substitutions, %f and %J.
110
128
The following is a complete list of valid strftime() substitutions:
111
129
</p>
112
130
 
177
195
2000-01-01. Format 11, the string 'now', is converted into the 
178
196
current date and time as obtained from the xCurrentTime method
179
197
of the <a href="c3ref/vfs.html">sqlite3_vfs</a> object in use.
180
 
<a href="http://en.wikipedia.org/wiki/Coordinated_Universal_Time">
181
 
Universal Coordinated Time (UTC)</a> is used. 
 
198
<a href="http://en.wikipedia.org/wiki/Coordinated_Universal_Time">Universal Coordinated Time (UTC)</a> is used. 
182
199
Format 12 is the 
183
200
<a href="http://en.wikipedia.org/wiki/Julian_day">Julian day number</a>
184
201
expressed as a floating point value.
234
251
follow a timestring of the form DDDDDDDDDD which expresses the number
235
252
of seconds since 1970 or if other modifiers
236
253
separate the "unixepoch" modifier from prior DDDDDDDDDD then the
237
 
behavior is undefined.</p>
 
254
behavior is undefined.
 
255
Due to precision limitations imposed by the implementations use
 
256
of 64-bit integers, the "unixepoch" modifier only works for
 
257
dates between 0000-01-01 00:00:00 and 5352-11-01 10:52:47 (unix times
 
258
of -62167219200 through 10675199167).</p>
238
259
 
239
260
<p>The "localtime" modifier (12) assumes the time string to its left is in
240
261
Universal Coordinated Time (UTC) and adjusts the time
317
338
this range, do the calculation, then map the year back.</p>
318
339
 
319
340
 
320
 
<p>Date computations do not give correct results for dates 
321
 
before Julian day number 0 (-4713-11-24 12:00:00).</p>
 
341
<p>These functions only work for dates between 0000-01-01 00:00:00
 
342
and 9999-12-31 23:59:59 (julidan day numbers 1721059.5 through 5373484.5).
 
343
For dates outside that range, the results of these
 
344
functions are undefined.</p>
322
345
 
323
346
<p>Non-Vista Windows platforms only support one set of DST rules. 
324
347
Vista only supports two. Therefore, on these platforms, 
329
352
getting results correct back to 1986, when the rules were also changed.</p>
330
353
 
331
354
<p>All internal computations assume the 
332
 
<a href="http://en.wikipedia.org/wiki/Gregorian_calendar">
333
 
Gregorian calendar</a> system.  It is also assumed that every
 
355
<a href="http://en.wikipedia.org/wiki/Gregorian_calendar">Gregorian calendar</a>
 
356
system.  It is also assumed that every
334
357
day is exactly 86400 seconds in duration.</p>
335
358
 
336
 
<hr><small><i>
337
 
This page last modified 2009/05/14 23:56:17 UTC
338
 
</i></small></div></body></html>
 
359