Documentation Source Text

Check-in Differences
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Difference From 5fca4e2367516d8b To cb8e7e8104235cee

2022-01-27
12:42
Updates to requirements marks and wording of the date/time functions. (check-in: 0dbb181411 user: drh tags: trunk)
00:19
Note inexactitude of strftime() %J and %s format specifiers (check-in: 5fca4e2367 user: larrybr tags: trunk)
2022-01-26
15:41
Clarify that "Julian day number" need not be a "whole number" (check-in: 841107fc38 user: larrybr tags: trunk)
2022-01-25
20:21
Fix typo on expression operators table (check-in: cb8e7e8104 user: larrybr tags: trunk)
2022-01-24
20:42
Take CLI rules clarification from release branch (check-in: 2d8eaff57d user: larrybr tags: trunk)

Changes to pages/lang_datefunc.in.

49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

<p>
^The datetime() function returns the date and time as text in their same formats: YYYY-MM-DD HH:MM:SS.

<p>
^(The julianday() function returns the 
[http://en.wikipedia.org/wiki/Julian_day | Julian day] - the
fractional number of days since noon in Greenwich on November 24, 4714 B.C. 
([http://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar | Proleptic Gregorian calendar]).)^

<tcl>hd_fragment uepch {unixepoch() function}</tcl>
<p>
^The unixepoch() function returns a unix timestamp - the number of seconds
since 1970-01-01 00:00:00 UTC.  ^The unixepoch() always returns an integer,
even if the input time-value has millisecond precision.







|







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

<p>
^The datetime() function returns the date and time as text in their same formats: YYYY-MM-DD HH:MM:SS.

<p>
^(The julianday() function returns the 
[http://en.wikipedia.org/wiki/Julian_day | Julian day] - the
number of days since noon in Greenwich on November 24, 4714 B.C. 
([http://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar | Proleptic Gregorian calendar]).)^

<tcl>hd_fragment uepch {unixepoch() function}</tcl>
<p>
^The unixepoch() function returns a unix timestamp - the number of seconds
since 1970-01-01 00:00:00 UTC.  ^The unixepoch() always returns an integer,
even if the input time-value has millisecond precision.
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
<table border="0" cellpadding="0" cellspacing="0">
<tr><td><td width="10"><td></tr>

<tr><td> %d <td><td> day of month: 00
<tr><td> %f <td><td> fractional seconds: SS.SSS
<tr><td> %H <td><td> hour: 00-24 
<tr><td> %j <td><td> day of year: 001-366
<tr><td> %J <td><td> Julian day number (fractional)
<tr><td> %m <td><td> month: 01-12
<tr><td> %M <td><td> minute: 00-59
<tr><td> %s <td><td> seconds since 1970-01-01
<tr><td> %S <td><td> seconds: 00-59
<tr><td> %w <td><td> day of week 0-6 with Sunday==0
<tr><td> %W <td><td> week of year: 00-53
<tr><td> %Y <td><td> year: 0000-9999
<tr><td> %% <td><td> %
</table>
</blockquote>)^

<p>
^(Notice that all other date and time functions can be expressed
in terms of strftime():
</p>

<blockquote>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td><b>Function</b><td width="30"><td><b>Equivalent (or nearly) strftime()</b>
<tr><td>   date(...)      <td><td>  strftime('%Y-%m-%d', ...)
<tr><td>   time(...)      <td><td>  strftime('%H:%M:%S', ...)
<tr><td>   datetime(...)  <td><td>  strftime('%Y-%m-%d %H:%M:%S', ...)
<tr><td>   julianday(...) <td><td>  strftime('%J', ...)&nbsp;&nbsp;(inexact)
<tr><td>   unixepoch(...) <td><td>  strftime('%s', ...)&nbsp;&nbsp;(inexact)
</table>
</blockquote>)^

<p>
The main reasons for providing functions other than strftime() are
for convenience and for efficiency. The julianday() and unixepoch()
functions return real and integer values respectively, and do not
incur the format conversion costs or inexactitude resulting from use
of the '%J' or '%s' format specifiers with the strftime() function.
</p>

<h1>Time Values</h1>

<p>^(A time value can be in any of the following formats shown below.
The value is usually a string, though it can be an integer or floating
point number in the case of format 12.







|


















|



|
|




|
|
<
<
<







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
<table border="0" cellpadding="0" cellspacing="0">
<tr><td><td width="10"><td></tr>

<tr><td> %d <td><td> day of month: 00
<tr><td> %f <td><td> fractional seconds: SS.SSS
<tr><td> %H <td><td> hour: 00-24 
<tr><td> %j <td><td> day of year: 001-366
<tr><td> %J <td><td> Julian day number
<tr><td> %m <td><td> month: 01-12
<tr><td> %M <td><td> minute: 00-59
<tr><td> %s <td><td> seconds since 1970-01-01
<tr><td> %S <td><td> seconds: 00-59
<tr><td> %w <td><td> day of week 0-6 with Sunday==0
<tr><td> %W <td><td> week of year: 00-53
<tr><td> %Y <td><td> year: 0000-9999
<tr><td> %% <td><td> %
</table>
</blockquote>)^

<p>
^(Notice that all other date and time functions can be expressed
in terms of strftime():
</p>

<blockquote>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td><b>Function</b><td width="30"><td><b>Equivalent strftime()</b>
<tr><td>   date(...)      <td><td>  strftime('%Y-%m-%d', ...)
<tr><td>   time(...)      <td><td>  strftime('%H:%M:%S', ...)
<tr><td>   datetime(...)  <td><td>  strftime('%Y-%m-%d %H:%M:%S', ...)
<tr><td>   julianday(...) <td><td>  strftime('%J', ...)
<tr><td>   unixepoch(...) <td><td>  strftime('%s', ...)
</table>
</blockquote>)^

<p>
The only reasons for providing functions other than strftime() is
for convenience and for efficiency.



</p>

<h1>Time Values</h1>

<p>^(A time value can be in any of the following formats shown below.
The value is usually a string, though it can be an integer or floating
point number in the case of format 12.