Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
903fce1e
提交
903fce1e
authored
3月 05, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Describe datetime fields in documentation
上级
d1ee5c8e
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
226 行增加
和
17 行删除
+226
-17
help.csv
h2/src/docsrc/help/help.csv
+175
-17
grammar.html
h2/src/docsrc/html/grammar.html
+49
-0
GenerateDoc.java
h2/src/tools/org/h2/build/doc/GenerateDoc.java
+2
-0
没有找到文件。
h2/src/docsrc/help/help.csv
浏览文件 @
903fce1e
...
...
@@ -1794,6 +1794,171 @@ Admin rights are required to execute this command.
SHUTDOWN COMPACT
"
"Datetime fields","Datetime field","
yearField | monthField | dayOfMonthField
| hourField | minuteField | secondField
| millisecondField | microsecondField | nanosecondField
| timezoneHourField | timezoneMinuteField
| dayOfWeekField | isoDayOfWeekField
| weekOfYearField | isoWeekOfYearField
| quarterField | dayOfYearField | epochField
","
Fields for EXTRACT, DATEADD, and DATEDIFF functions.
","
YEAR
"
"Datetime fields","Year field","
YEAR | YYYY | YY | SQL_TSI_YEAR
","
Year.
","
YEAR
"
"Datetime fields","Month field","
MONTH | MM | M | SQL_TSI_MONTH
","
Month (1-12).
","
MONTH
"
"Datetime fields","Day of month field","
DAY | DD | D | SQL_TSI_DAY
","
Day of month (1-31).
","
DAY
"
"Datetime fields","Hour field","
HOUR | HH | SQL_TSI_HOUR
","
Hour (0-23).
","
HOUR
"
"Datetime fields","Minute field","
MINUTE | MI | N | SQL_TSI_MINUTE
","
Minute (0-59).
","
MINUTE
"
"Datetime fields","Second field","
SECOND | SS | S | SQL_TSI_SECOND
","
Second (0-59).
","
SECOND
"
"Datetime fields","Millisecond field","
MILLISECOND | MS
","
Millisecond (0-999).
","
MILLISECOND
"
"Datetime fields","Microsecond field","
MICROSECOND | MCS
","
Microsecond (0-999999).
","
MICROSECOND
"
"Datetime fields","Nanosecond field","
NANOSECOND | NS
","
Nanosecond (0-999999999).
","
NANOSECOND
"
"Datetime fields","Timezone hour field","
TIMEZONE_HOUR
","
Timezone hour (from -18 to +18).
","
TIMEZONE_HOUR
"
"Datetime fields","Timezone minute field","
TIMEZONE_MINUTE
","
Timezone minute (from -59 to +59).
","
TIMEZONE_MINUTE
"
"Datetime fields","Day of week field","
DAY_OF_WEEK | DAYOFWEEK | DOW
","
Day of week (1-7). Sunday is 1.
","
DAY_OF_WEEK
"
"Datetime fields","ISO day of week field","
ISO_DAY_OF_WEEK
","
ISO day of week (1-7). Monday is 1.
","
ISO_DAY_OF_WEEK
"
"Datetime fields","Week of year field","
WEEK | WW | W | SQL_TSI_WEEK
","
Week of year (1-53).
EXTRACT function uses local rules to get number of week in year.
DATEDIFF function uses Sunday as a first day of week.
","
WEEK
"
"Datetime fields","ISO week of year field","
ISO_WEEK
","
ISO week of year (1-53).
Monday used as a first day of week.
First week of year contains 4 or more days.
","
ISO_WEEK
"
"Datetime fields","Quarter field","
QUARTER
","
Quarter (1-4).
","
QUARTER
"
"Datetime fields","Day of year field","
DAYOFYEAR | DAY_OF_YEAR | DOY | DY
","
Day of year (1-366).
","
DAYOFYEAR
"
"Datetime fields","Epoch field","
EPOCH
","
For TIMESTAMP values number of seconds since 1970-01-01 00:00:00 in local time zone.
For TIMESTAMP WITH TIME ZONE values number of seconds since 1970-01-01 00:00:00 in UTC time zone.
For DATE values number of seconds since 1970-01-01.
For TIME values number of seconds since midnight.
","
EPOCH
"
"Other Grammar","Alias","
name
","
...
...
@@ -3704,30 +3869,28 @@ CURRENT_TIMESTAMP()
"
"Functions (Time and Date)","DATEADD","
{ DATEADD| TIMESTAMPADD } (
unitString
, addIntLong, dateAndTime)
{ DATEADD| TIMESTAMPADD } (
datetimeField
, addIntLong, dateAndTime)
","
Adds units to a date-time value. The string indicates the unit.
Use negative values to subtract units.
addIntLong may be a long value when manipulating milliseconds,
microseconds, or nanoseconds otherwise its range is restricted to int.
The same units as in the EXTRACT function are supported.
This method returns a value with the same type as specified value if unit is compatible with this value.
If specified
unit
is a HOUR, MINUTE, SECOND, MILLISECOND, etc and value is a DATE value DATEADD returns combined TIMESTAMP.
Unit
s DAY, MONTH, YEAR, WEEK, etc are not allowed for TIME values.
Unit
s TIMEZONE_HOUR and TIMEZONE_MINUTE are only allowed for TIMESTAMP WITH TIME ZONE values.
If specified
field
is a HOUR, MINUTE, SECOND, MILLISECOND, etc and value is a DATE value DATEADD returns combined TIMESTAMP.
Field
s DAY, MONTH, YEAR, WEEK, etc are not allowed for TIME values.
Field
s TIMEZONE_HOUR and TIMEZONE_MINUTE are only allowed for TIMESTAMP WITH TIME ZONE values.
","
DATEADD('MONTH', 1, DATE '2001-01-31')
"
"Functions (Time and Date)","DATEDIFF","
{ DATEDIFF | TIMESTAMPDIFF } (
unitString
, aDateAndTime, bDateAndTime)
{ DATEDIFF | TIMESTAMPDIFF } (
datetimeField
, aDateAndTime, bDateAndTime)
","
Returns the the number of crossed unit boundaries between two date/time values.
This method returns a long.
The string indicates the unit.
The same units as in the EXTRACT function are supported.
Only TIMEZONE_HOUR and TIMEZONE_MINUTE units use the time zone offset component.
With all other units if date/time values have time zone offset component it is ignored.
Only TIMEZONE_HOUR and TIMEZONE_MINUTE fields use the time zone offset component.
With all other fields if date/time values have time zone offset component it is ignored.
","
DATEDIFF('YEAR', T1.CREATED, T2.CREATED)
"
...
...
@@ -3765,16 +3928,11 @@ DAY_OF_YEAR(CREATED)
"
"Functions (Time and Date)","EXTRACT","
EXTRACT ( { YEAR | YY | MONTH | MM | QUARTER | WEEK | ISO_WEEK
| DAY | DD | DAY_OF_YEAR | DOY
| HOUR | HH | MINUTE | MI | SECOND | SS | EPOCH
| MILLISECOND | MS | MICROSECOND | MCS | NANOSECOND | NS
| TIMEZONE_HOUR | TIMEZONE_MINUTE }
FROM dateAndTime )
EXTRACT ( datetimeField FROM dateAndTime )
","
Returns a value of the specific time unit from a date/time value.
This method returns a numeric value with EPOCH
unit
and
an int for all other
time unit
s.
This method returns a numeric value with EPOCH
field
and
an int for all other
field
s.
","
EXTRACT(SECOND FROM CURRENT_TIMESTAMP)
"
...
...
h2/src/docsrc/html/grammar.html
浏览文件 @
903fce1e
...
...
@@ -103,6 +103,34 @@ syntax-end -->
</table>
<!-- railroad-end -->
<h3>
Datetime fields
</h3>
<!-- syntax-start
<p class="notranslate">
<c:forEach var="item" items="datetimeFields">
<a href="#${item.link}">${item.topic}</a><br />
</c:forEach>
</p>
syntax-end -->
<!-- railroad-start -->
<table
class=
"notranslate index"
>
<tr>
<td
class=
"index"
>
<c:forEach
var=
"item"
items=
"datetimeFields-0"
>
<a
href=
"#${item.link}"
>
${item.topic}
</a><br
/>
</c:forEach>
</td><td
class=
"index"
>
<c:forEach
var=
"item"
items=
"datetimeFields-1"
>
<a
href=
"#${item.link}"
>
${item.topic}
</a><br
/>
</c:forEach>
</td><td
class=
"index"
>
<c:forEach
var=
"item"
items=
"datetimeFields-2"
>
<a
href=
"#${item.link}"
>
${item.topic}
</a><br
/>
</c:forEach>
</td>
</tr>
</table>
<!-- railroad-end -->
<h3>
Other Grammar
</h3>
<!-- syntax-start
<p class="notranslate">
...
...
@@ -163,6 +191,27 @@ syntax-end -->
${item.example}
</p>
</c:forEach>
<c:forEach
var=
"item"
items=
"datetimeFields"
>
<h3
id=
"${item.link}"
class=
"notranslate"
onclick=
"switchBnf(this)"
>
${item.topic}
</h3>
<!-- railroad-start -->
<pre
name=
"bnf"
style=
"display: none"
>
${item.syntax}
</pre>
<div
name=
"railroad"
>
${item.railroad}
</div>
<!-- railroad-end -->
<!-- syntax-start
<pre>
${item.syntax}
</pre>
syntax-end -->
<p>
${item.text}
</p>
<p>
Example:
</p>
<p
class=
"notranslate"
>
${item.example}
</p>
</c:forEach>
<c:forEach
var=
"item"
items=
"otherGrammar"
>
<h3
id=
"${item.link}"
class=
"notranslate"
onclick=
"switchBnf(this)"
>
${item.topic}
</h3>
<!-- railroad-start -->
...
...
h2/src/tools/org/h2/build/doc/GenerateDoc.java
浏览文件 @
903fce1e
...
...
@@ -78,6 +78,8 @@ public class GenerateDoc {
help
+
"= 'Commands (DDL)' ORDER BY ID"
,
false
);
map
(
"commandsOther"
,
help
+
"= 'Commands (Other)' ORDER BY ID"
,
false
);
map
(
"datetimeFields"
,
help
+
"= 'Datetime fields' ORDER BY ID"
,
true
);
map
(
"otherGrammar"
,
help
+
"= 'Other Grammar' ORDER BY ID"
,
true
);
map
(
"functionsAggregate"
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论