forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Su, Xiaomeng <suxiaomeng1@huawei.com> Co-committed-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
1808 lines
167 KiB
HTML
1808 lines
167 KiB
HTML
<a name="dli_08_15090"></a><a name="dli_08_15090"></a>
|
|
|
|
<h1 class="topictitle1">Temporal Functions</h1>
|
|
<div id="body0000001262335946"><p id="dli_08_15090__dli_08_0097_a0afc1542d28746fc9572e1ad11e28d5d"><a href="#dli_08_15090__dli_08_0097_ta2a0e6534d354c7195ebf06580c6c081">Table 1</a> lists the time functions supported by Flink OpenSource SQL.</p>
|
|
<div class="section" id="dli_08_15090__dli_08_0097_section565310510264"><h4 class="sectiontitle">Description</h4>
|
|
<div class="tablenoborder"><a name="dli_08_15090__dli_08_0097_ta2a0e6534d354c7195ebf06580c6c081"></a><a name="dli_08_0097_ta2a0e6534d354c7195ebf06580c6c081"></a><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__dli_08_0097_ta2a0e6534d354c7195ebf06580c6c081" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Temporal Functions</caption><thead align="left"><tr id="dli_08_15090__dli_08_0097_r94e9c30c23dd4af3908643ddb78b35c7"><th align="left" class="cellrowborder" valign="top" width="29.673267326732677%" id="mcps1.3.2.2.2.4.1.1"><p id="dli_08_15090__dli_08_0097_af3c0a9ba4b4f47dab3c76ec63484ed7f">Function</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="13.792079207920793%" id="mcps1.3.2.2.2.4.1.2"><p id="dli_08_15090__dli_08_0097_en-us_topic_0060575890_p062042117432">Return Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="56.53465346534653%" id="mcps1.3.2.2.2.4.1.3"><p id="dli_08_15090__dli_08_0097_aa80b70b4f1624621a61e741988c5d582">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__dli_08_0097_r2d5dbdcae7e949b1bda4187fec7e1840"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__dli_08_0097_ac86f61fa314d4836821b7c19d57ed457"><a href="#dli_08_15090__section14378194561717">DATE string</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__dli_08_0097_a6390bb9c83434bf1abc803877f93c5fd">DATE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__dli_08_0097_en-us_topic_0060575890_p097102217463">Returns the SQL date parsed from a string in the format of "yyyy-MM-dd".</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row91111914143518"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p13111114173516"><a href="#dli_08_15090__section034681694312">DATE_ADD</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p16111181414355">STRING</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p1011113145359">Resulting date after adding a certain number of days to a specified date. The data type is <strong id="dli_08_15090__b2036615446136">STRING</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row16881181117354"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p118811911123513"><a href="#dli_08_15090__section1911043616439">DATE_SUB</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p28811711173517">STRING</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p13881311143511">Resulting date after subtracting a certain number of days from a specified date. The data type is <strong id="dli_08_15090__b157274448144">STRING</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__dli_08_0097_re6037d00a4ca402aba8919a6a11ea8e4"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__dli_08_0097_en-us_topic_0060575890_p66208213435"><a href="#dli_08_15090__section360564211339">TIME string</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__dli_08_0097_afc52ddf9a3494f5cada4cae31e07326c">TIME</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p622220174485">Returns the SQL time parsed from a string in the format of "HH:mm:ss".</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__dli_08_0097_r09c43fb588884afd86c80c79a92d92b0"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__dli_08_0097_en-us_topic_0060575890_p062182113439"><a href="#dli_08_15090__section1878994533516">TIMESTAMP string</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__dli_08_0097_a59ddaba2be4d49bb989825b24c45e7d6">TIMESTAMP</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__dli_08_0097_a8e5a140307a44c7a9bba48033ce4096a">Returns the SQL timestamp parsed from a string in the format of "yyyy-MM-dd HH:mm:ss[.SSS]".</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__dli_08_0097_r02301fcf0eb94f9eb6ffa285ba5399c0"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__dli_08_0097_a07ebf2beb37442a8bc0510aa92ae391d"><a href="#dli_08_15090__section8680184819367">INTERVAL string range</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__dli_08_0097_en-us_topic_0060575890_p257191085014">INTERVAL</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p12357125134810">Parses the SQL millisecond interval from a string in the format of "dd hh:mm:ss.fff" or the SQL month interval from a string in the format of "yyyy-mm".</p>
|
|
<p id="dli_08_15090__p17243499497">The interval range can be <strong id="dli_08_15090__b188481751127">DAY</strong>, <strong id="dli_08_15090__b1874247171219">MINUTE</strong>, <strong id="dli_08_15090__b1840171117121">DAY TO HOUR</strong>, or <strong id="dli_08_15090__b1140417140128">DAY TO SECOND</strong>, with the interval in milliseconds; <strong id="dli_08_15090__b899902011211">YEAR</strong> or <strong id="dli_08_15090__b9399323131220">YEAR TO MONTH</strong> represents the interval in months.</p>
|
|
<p id="dli_08_15090__dli_08_0097_en-us_topic_0060575890_p849154571214">For example, <strong id="dli_08_15090__b18961175614127">INTERVAL '10 00:00:00.004' DAY TO SECOND</strong>, <strong id="dli_08_15090__b250818416137">INTERVAL '10' DAY</strong>, or <strong id="dli_08_15090__b115301109134">INTERVAL '2-10' YEAR TO MONTH</strong> returns the interval.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__dli_08_0097_r452fd9bcac904451a132b11e8b93d994"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__dli_08_0097_a6965d1077bf6425f9aa006163ededed0"><a href="#dli_08_15090__section17211159143814">CURRENT_DATE</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__dli_08_0097_a1a61c57d956e436f82015b10e1fa1c6a">DATE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__dli_08_0097_en-us_topic_0060575890_p2938947522">Returns the current SQL date in the local time zone. In streaming mode, it is evaluated for each record. In batch processing mode, it is evaluated once at the beginning of the query and the same result is used for each row.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__dli_08_0097_r814ffb81098d45b9bb8e6afe4d135390"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__dli_08_0097_en-us_topic_0060575890_p7541167406"><a href="#dli_08_15090__section207768598406">CURRENT_TIME</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__dli_08_0097_a22a3f9e012eb4a48a21a17b131fbeaf3">TIME</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p1359314114491">Returns the current SQL time in the local time zone, which is a synonym for <strong id="dli_08_15090__b15185133211145">LOCAL_TIME</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__dli_08_0097_r4ce2696a760c453eb3982feb3a50b630"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__dli_08_0097_a1249662b8bff4bef8086c9fe4a13f29a"><a href="#dli_08_15090__section17661335184515">CURRENT_TIMESTAMP</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__dli_08_0097_a20c5d0b9ef3c4b2bb09c8a301d2775c3">TIMESTAMP</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p151155474914">Returns the current SQL timestamp in the local time zone, with the return type of <strong id="dli_08_15090__b1478313613159">TIMESTAMP_LTZ(3)</strong>. In streaming mode, it is evaluated for each record. In batch processing mode, it is evaluated once at the beginning of the query and the same result is used for each row.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__dli_08_0097_r2501ad96582b42b8a16a6d9ee6472488"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__dli_08_0097_en-us_topic_0060575890_p852131644019"><a href="#dli_08_15090__section11477133554614">LOCALTIME</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__dli_08_0097_aaed36ae8f2dd4bc191f803537d5fd285">TIME</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__dli_08_0097_a124cad95c1d245a8b14fe7fb4ddb9897">Returns the current SQL time in the local time zone, with the return type of <strong id="dli_08_15090__b1593425461518">TIME(0)</strong>. In streaming mode, it is evaluated for each record. In batch processing mode, it is evaluated once at the beginning of the query and the same result is used for each row.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__dli_08_0097_r2e3fbb4619bb40ccbc11d29a22f86d83"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__dli_08_0097_af689318e7c264e62aa4b2421fe20a36d"><a href="#dli_08_15090__section14830142934817">LOCALTIMESTAMP</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__dli_08_0097_adb38d4dbf6654577ae44c14eb7c8911d">TIMESTAMP</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__dli_08_0097_a85b54e5560b74f31a5e9112f92ae4b84">Returns the current SQL timestamp in the local time zone, with the return type of <strong id="dli_08_15090__b19531126111616">TIMESTAMP(3)</strong>. In streaming mode, it is evaluated for each record. In batch processing mode, it is evaluated once at the beginning of the query and the same result is used for each row.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row1090172825011"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p19901628105012">NOW()</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p12901628145019">TIMESTAMP</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p159010286508">Returns the current SQL timestamp in the local time zone, which is a synonym for <strong id="dli_08_15090__b33961554111618">CURRENT_TIMESTAMP</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row1093014308508"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p993015301505">CURRENT_ROW_TIMESTAMP()</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p12930193016506">TIMESTAMP_LTZ(3)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p3930153010509">Returns the current SQL timestamp in the local time zone, with the return type of <strong id="dli_08_15090__b10827112218177">TIMESTAMP_LTZ(3)</strong>. It is evaluated for each record, regardless of whether it is in batch processing mode or streaming mode.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__dli_08_0097_rf661654af51b42999987cea96ef62a53"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__dli_08_0097_en-us_topic_0060575890_p7507165405"><a href="#dli_08_15090__section184791718509">EXTRACT(timeintervalunit FROM temporal)</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__dli_08_0097_en-us_topic_0060575890_p8530105500">BIGINT</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p1216845118">Returns the long value extracted from the time interval unit part of the time.</p>
|
|
<p id="dli_08_15090__dli_08_0097_a2db479eec5b24736bb5691fc968a67f3">For example, <strong id="dli_08_15090__b16370122853216">EXTRACT(DAY FROM DATE '2006-06-05')</strong> returns <strong id="dli_08_15090__b24991730123218">5</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row028717578494"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p7287657144910"><a href="#dli_08_15090__section1643812191377">YEAR(date)</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p162871057164913">BIGINT</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p1993291411515">Returns the year from the SQL date, which is equivalent to <strong id="dli_08_15090__b018444519336">EXTRACT(YEAR FROM date)</strong>. For example, <strong id="dli_08_15090__b16815830173311">YEAR(DATE '1994-09-27')</strong> returns <strong id="dli_08_15090__b19890123211337">1994</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row3689115924915"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p87162045318"><a href="#dli_08_15090__section517261154017">QUARTER(date)</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p57220105311">BIGINT</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p16400163017510">Returns the quarter of the year from the SQL date, which is an integer between 1 and 4, equivalent to <strong id="dli_08_15090__b658784011295">EXTRACT(QUARTER FROM date)</strong>.</p>
|
|
<p id="dli_08_15090__p1771204532">For example, <strong id="dli_08_15090__b948911017358">QUARTER(DATE '1994-09-27')</strong> returns <strong id="dli_08_15090__b95852218354">3</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row912320245017"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p51231212509"><a href="#dli_08_15090__section838818144523">MONTH(date)</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p5123102155013">BIGINT</p>
|
|
<p id="dli_08_15090__p341020269582"></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p21739413518">Returns the month of the year from the SQL date, which is an integer between 1 and 12, equivalent to <strong id="dli_08_15090__b734664313295">EXTRACT(MONTH FROM date)</strong>.</p>
|
|
<p id="dli_08_15090__p313617374512">For example, <strong id="dli_08_15090__b959431244510">MONTH(DATE '1994-09-27')</strong> returns <strong id="dli_08_15090__b1187171410458">9</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row745113415502"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p10451144145020"><a href="#dli_08_15090__section08692035515">WEEK(date)</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p1045184205016">BIGINT</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p1929010516517">Returns the week of the year from the SQL date, which is an integer between 1 and 53, equivalent to <strong id="dli_08_15090__b14707104613294">EXTRACT(WEEK FROM date)</strong>.</p>
|
|
<p id="dli_08_15090__p14449246105110">For example, <strong id="dli_08_15090__b1359021365219">WEEK(DATE '1994-09-27')</strong> returns <strong id="dli_08_15090__b17203163520">39</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row1911547125014"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p41151171508"><a href="#dli_08_15090__section35952273562">DAYOFYEAR(date)</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p131157785011">BIGINT</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p12798510527">Returns the day of the year from the SQL date, which is an integer between 1 and 366, equivalent to <strong id="dli_08_15090__b118950142912">EXTRACT(DOY FROM date)</strong>.</p>
|
|
<p id="dli_08_15090__p3203141155218">For example, <strong id="dli_08_15090__b25471717205320">DAYOFYEAR(DATE '1994-09-27')</strong> returns <strong id="dli_08_15090__b1747811916536">270</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row5881031192313"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p1288173120232"><a href="#dli_08_15090__section89188327592">DAYOFMONTH(date)</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p3881143116232">BIGINT</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p19212192075215">Returns the day of the month from the SQL date, which is an integer between 1 and 31, equivalent to <strong id="dli_08_15090__b186013523296">EXTRACT(DAY FROM date)</strong>.</p>
|
|
<p id="dli_08_15090__p929954692615">For example, <strong id="dli_08_15090__b11418061504495">DAYOFWEEK(DATE '1994-09-27')</strong> returns <strong id="dli_08_15090__b2614442944495">3</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row176251535122314"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p2625113552314"><a href="#dli_08_15090__section152759367121">DAYOFWEEK(date)</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p2062518357233">BIGINT</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p362583519231">Calculates which day of the week the current date is, with Sunday being <strong id="dli_08_15090__b1549263085715">1</strong>.</p>
|
|
<p id="dli_08_15090__p15735812113617">For example, <strong id="dli_08_15090__b7339297754495">DAYOFWEEK(DATE'1994-09-27')</strong> returns <strong id="dli_08_15090__b6747244184495">3</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row1698315811270"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p698388162717"><a href="#dli_08_15090__section34301613121413">HOUR(timestamp)</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p1098310812714">BIGINT</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p126191032155219">Returns the hour part of the hour unit from the SQL timestamp, which is an integer between 0 and 23, equivalent to <strong id="dli_08_15090__b88109556299">EXTRACT(HOUR FROM timestamp)</strong>.</p>
|
|
<p id="dli_08_15090__p61153110408">For example, <strong id="dli_08_15090__b131538493582">MINUTE(TIMESTAMP '1994-09-27 13:14:15')</strong> returns <strong id="dli_08_15090__b1985195165811">14</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row1822314115272"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p202241114273"><a href="#dli_08_15090__section17296191222215">MINUTE(timestamp)</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p92241611162717">BIGINT</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p2076994535217">Returns the minute part of the minute unit from the SQL timestamp, which is an integer between 0 and 59, equivalent to <strong id="dli_08_15090__b5491105972917">EXTRACT(MINUTE FROM timestamp)</strong>.</p>
|
|
<p id="dli_08_15090__p4845162274110">For example, <strong id="dli_08_15090__b113438608">MINUTE(TIMESTAMP '1994-09-27 13:14:15')</strong> returns <strong id="dli_08_15090__b51351880017">14</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row421811316273"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p221811372717"><a href="#dli_08_15090__section125214317232">SECOND(timestamp)</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p22184130277">BIGINT</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p1427218579526">Returns the second part of the second unit from the SQL timestamp, which is an integer between 0 and 59, equivalent to <strong id="dli_08_15090__b39716211300">EXTRACT(SECOND FROM timestamp)</strong>.</p>
|
|
<p id="dli_08_15090__p16902923194210">For example, <strong id="dli_08_15090__b336714221112">SECOND(TIMESTAMP '1994-09-27 13:14:15')</strong> returns <strong id="dli_08_15090__b14795102519114">15</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row0556245184117"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p1455684513419"><a href="#dli_08_15090__section114922047182416">FLOOR(timepoint TO timeintervalunit)</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p195567455417">TIME</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p7689112644310">Returns the value of <strong id="dli_08_15090__b84361720425">timepoint</strong> rounded down to the time interval unit <strong id="dli_08_15090__b13923731628">timeintervalunit</strong>. For example, <strong id="dli_08_15090__b1965920316215">FLOOR(TIME '12:44:31' TO MINUTE)</strong> returns <strong id="dli_08_15090__b08184612213">12:44:00</strong>. </p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row21061243124114"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p2106843194111"><a href="#dli_08_15090__section345282814439">CEIL(timepoint TO timeintervalunit)</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p1910654314412">TIME</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p1697851919530">Return the value of <strong id="dli_08_15090__b22221251053">timepoint</strong> rounded up to the time interval unit <strong id="dli_08_15090__b445829156">timeintervalunit</strong>.</p>
|
|
<p id="dli_08_15090__p152750513439">For example, <strong id="dli_08_15090__b9536134220515">CEIL(TIME '12:44:31' TO MINUTE)</strong> returns <strong id="dli_08_15090__b1217712491259">12:45:00</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row1512284134115"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p5122164124116"><a href="#dli_08_15090__section132721624154711">(timepoint1, temporal1) OVERLAPS (timepoint2, temporal2)</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p0122041124110">BOOLEAN</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p2860834125311">Returns <strong id="dli_08_15090__b1797171819611">TRUE</strong> if the two time intervals defined by (timepoint1, temporal1) and (timepoint2, temporal2) overlap. The time value can be a time point or a time interval. For example, <strong id="dli_08_15090__b12505818577">(TIME '2:55:00', INTERVAL '1' HOUR) OVERLAPS (TIME '3:30:00', INTERVAL '2' HOUR)</strong> returns <strong id="dli_08_15090__b1873814201771">TRUE</strong>;</p>
|
|
<p id="dli_08_15090__p8149128175019"><strong id="dli_08_15090__b8691432479">(TIME '9:00:00', TIME '10:00:00') OVERLAPS (TIME '10:15:00', INTERVAL '3' HOUR)</strong> returns <strong id="dli_08_15090__b133513348710">FALSE</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row1565415446"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p1561747447"><a href="#dli_08_15090__section98557160415">DATE_FORMAT(timestamp, string)</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p16568474420">STRING</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p126544235318">Converts the timestamp to a string value in the specified date format string. The format string is compatible with Java's SimpleDateFormat.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row48031710446"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p28031114448"><a href="#dli_08_15090__section105601517203220">TIMESTAMPADD(timeintervalunit, interval, timepoint)</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p38031019443">TIMESTAMP/DATE/TIME</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p1667711375516">Adds the result of combining <strong id="dli_08_15090__b137385815298">interval</strong> with <strong id="dli_08_15090__b1487083632914">timeintervalunit</strong> to a <strong id="dli_08_15090__b492124520299">timepoint</strong> that includes a date or datetime, and returns the resulting datetime.</p>
|
|
<p id="dli_08_15090__p480316164418">For example, <strong id="dli_08_15090__b13436130034495">TIMESTAMPADD(WEEK, 1, DATE '2003-01-02')</strong> returns <strong id="dli_08_15090__b11753223554495">2003-01-09</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row9873125914313"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p487335904318"><a href="#dli_08_15090__section16290114810404">TIMESTAMPDIFF(timepointunit, timepoint1, timepoint2)</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p58731959174317">INT</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p0168180195416">Returns the time interval between <strong id="dli_08_15090__b2925185145816">timepoint1</strong> and <strong id="dli_08_15090__b209651753185813">timepoint2</strong>. The unit of the interval is given by the first parameter, which should be one of the following values: <strong id="dli_08_15090__b357172435918">SECOND</strong>, <strong id="dli_08_15090__b1866462617593">MINUTE</strong>, <strong id="dli_08_15090__b1246162845913">HOUR</strong>, <strong id="dli_08_15090__b05110293590">DAY</strong>, <strong id="dli_08_15090__b1013031145910">MONTH</strong>, or <strong id="dli_08_15090__b45361032205918">YEAR</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row1693732212117"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p109373227114"><a href="#dli_08_15090__section1698193003115">CONVERT_TZ(string1, string2, string3)</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p15937162216113">TIMESTAMP</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p1616701435411">Convert the datetime <strong id="dli_08_15090__b95129271303">string1</strong> (with the default ISO timestamp format 'yyyy-MM-dd HH:mm:ss') from time zone <strong id="dli_08_15090__b08440381303">string2</strong> to the value in time zone <strong id="dli_08_15090__b1447616421907">string3</strong>. The format of time zone should be either an abbreviation such as <strong id="dli_08_15090__b75279421123">PST</strong>, a full name such as <strong id="dli_08_15090__b17527104241219">Country A/City A</strong>, or a custom ID such as <strong id="dli_08_15090__b4533642101219">GMT-08:00</strong>.</p>
|
|
<p id="dli_08_15090__p2984151515915">For example, <strong id="dli_08_15090__b19748647171210">CONVERT_TZ('1970-01-01 00:00:00', 'UTC', 'Country A/City A')</strong> returns <strong id="dli_08_15090__b8748347101217">'1969-12-31 16:00:00'</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row183471629813"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p1834720298113"><a href="#dli_08_15090__section01032914372">FROM_UNIXTIME(numeric[, string])</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p33474293119">STRING</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p172361725175417">Returns the representation of the numeric parameter <strong id="dli_08_15090__b16802125717212">numberic</strong> in the string format (default is <strong id="dli_08_15090__b264117101834">yyyy-MM-dd HH:mm:ss</strong>). Numeric is an internal timestamp value that represents the number of seconds since '1970-01-01 00:00:00' UTC, generated by the <strong id="dli_08_15090__b439911395311">UNIX_TIMESTAMP()</strong> function. The return value is represented in the session time zone (specified in TableConfig).</p>
|
|
<p id="dli_08_15090__p1177645271918">For example, if in the UTC time zone, <strong id="dli_08_15090__b1346418452520">FROM_UNIXTIME(44)</strong> returns <strong id="dli_08_15090__b29792583520">1970-01-01 00:00:44</strong>, and if in the Asia/Tokyo time zone, it returns <strong id="dli_08_15090__b1370822760">1970-01-01 09:00:44</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row2341112515117"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p13419254113"><a href="#dli_08_15090__section166571146145016">UNIX_TIMESTAMP()</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p7341725519">BIGINT</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p1634113251619">Gets the current Unix timestamp in seconds. This function is non-deterministic, meaning it will be recomputed for each record.</p>
|
|
<p id="dli_08_15090__p191163210222"></p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row17235152713114"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p14235527718"><a href="#dli_08_15090__section175599271533">UNIX_TIMESTAMP(string1[, string2])</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p52354271116">BIGINT</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p72351927414">Converts the datetime <strong id="dli_08_15090__b119815367118">string1</strong> in the format of <strong id="dli_08_15090__b5366239111217">string2</strong> (default is 'yyyy-MM-dd HH:mm:ss') to a Unix timestamp in seconds, using the time zone specified in the table configuration.</p>
|
|
<p id="dli_08_15090__p325613334315"></p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row114830188249"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p8483161819243"><a href="#dli_08_15090__section1871816161526">TO_DATE(string1[, string2])</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p11483151819241">DATE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p3412175285413">Converts the <strong id="dli_08_15090__b357372410132">string1</strong> in the format of <strong id="dli_08_15090__b13212162881314">string2</strong> (default is <strong id="dli_08_15090__b526511512210">yyyy-MM-dd</strong>) to a date.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row925720171556"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p225751785517">TO_TIMESTAMP_LTZ(numeric, precision)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p142571217145512">TIMESTAMP_LTZ</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p1257161795517">Converts the epoch seconds or epoch milliseconds to <strong id="dli_08_15090__b1255819617149">TIMESTAMP_LTZ</strong>, with a valid precision of 0 or 3, where 0 represents <strong id="dli_08_15090__b7310143082010">TO_TIMESTAMP_LTZ</strong>(epochSeconds, 0) and 3 represents <strong id="dli_08_15090__b16387113419207">TO_TIMESTAMP_LTZ</strong>(epochMilliseconds, 3).</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row14346320152417"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p4346192015249"><a href="#dli_08_15090__section1374114020551">TO_TIMESTAMP(string1[, string2])</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p183462020172411">TIMESTAMP</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p877192115520">Converts the <strong id="dli_08_15090__b10630559102011">string1</strong> in the format of <strong id="dli_08_15090__b136491776214">string2</strong> (default is <strong id="dli_08_15090__b61201436152114">yyyy-MM-dd HH:mm:ss</strong>) in the UTC+0 time zone to a timestamp.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row979044585512"><td class="cellrowborder" valign="top" width="29.673267326732677%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_15090__p16790114514557">CURRENT_WATERMARK(rowtime)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.792079207920793%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_15090__p18575192255620">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.53465346534653%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_15090__p1964919584557">Returns the current watermark of the given time column attribute <strong id="dli_08_15090__b1436613818302">rowtime</strong>. If there is no common watermark available from upstream operations in the pipeline, the function returns <strong id="dli_08_15090__b17367128113019">NULL</strong>. The return type of the function is inferred to match the provided time column attribute, but with an adjusted precision of 3. For example, if the time column attribute is <strong id="dli_08_15090__b1723233215246">TIMESTAMP_LTZ(9)</strong>, the function returns <strong id="dli_08_15090__b83961839192415">TIMESTAMP_LTZ(3)</strong>.</p>
|
|
<p id="dli_08_15090__p1264918584553">Note that this function can return <strong id="dli_08_15090__b167935513247">NULL</strong>, which you may need to consider. For example, if you want to filter out late data, you can use:</p>
|
|
<pre class="screen" id="dli_08_15090__screen13649155819558">WHERE CURRENT_WATERMARK(ts) IS NULL OR ts > CURRENT_WATERMARK(ts)</pre>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section14378194561717"><a name="dli_08_15090__section14378194561717"></a><a name="section14378194561717"></a><h4 class="sectiontitle">DATE</h4><ul id="dli_08_15090__ul202988559179"><li id="dli_08_15090__li1529825511713"><strong id="dli_08_15090__b16261143915188">Function</strong><p id="dli_08_15090__p1652615285183">Returns a SQL date parsed from string in form of <strong id="dli_08_15090__b2757154010315">yyyy-MM-dd</strong>.</p>
|
|
</li><li id="dli_08_15090__li991314510181"><strong id="dli_08_15090__b6991541103218">Description</strong><pre class="screen" id="dli_08_15090__screen85953333326">DATE <strong id="dli_08_15090__b119751846134812">DATE </strong>string</pre>
|
|
</li><li id="dli_08_15090__li3917139131820"><strong id="dli_08_15090__b67181943153217">Input parameters</strong>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table11910153753010" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row1791118372301"><th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.3.2.3.2.1.4.1.1"><p id="dli_08_15090__p18911173713018">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.3.2.3.2.1.4.1.2"><p id="dli_08_15090__p39117373307">Data Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.3.2.3.2.1.4.1.3"><p id="dli_08_15090__p1391193712304">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row1891183710301"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.3.2.3.2.1.4.1.1 "><p id="dli_08_15090__p19112037123017">string</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.3.2.3.2.1.4.1.2 "><p id="dli_08_15090__p1491111377308">STRING</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.3.2.3.2.1.4.1.3 "><p id="dli_08_15090__p4883114991116">String in the SQL date format. </p>
|
|
<p id="dli_08_15090__p891173715309">Note that the string must be in the <strong id="dli_08_15090__b11706887384495">yyyy-MM-dd</strong> format. Otherwise, an error will be reported.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="dli_08_15090__li374581412189"><strong id="dli_08_15090__b568845443214">Example</strong><ul id="dli_08_15090__ul138618914337"><li id="dli_08_15090__li1933692417358">Test statement<pre class="screen" id="dli_08_15090__screen1150181573219">SELECT
|
|
DATE "2021-08-19" AS `result`
|
|
FROM
|
|
testtable;</pre>
|
|
</li><li id="dli_08_15090__li14230202883518">Test Result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table0224118113517" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row10224141819357"><th align="left" class="cellrowborder" valign="top" width="100%" id="mcps1.3.3.2.4.2.2.1.1.2.1.1"><p id="dli_08_15090__p836324211360">result</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row1722431817358"><td class="cellrowborder" valign="top" width="100%" headers="mcps1.3.3.2.4.2.2.1.1.2.1.1 "><p id="dli_08_15090__p8978446163612">2021-08-19</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section034681694312"><a name="dli_08_15090__section034681694312"></a><a name="section034681694312"></a><h4 class="sectiontitle">DATE_ADD</h4><ul id="dli_08_15090__ul53591920114416"><li id="dli_08_15090__li1735913207449"><strong id="dli_08_15090__b1144510204151">Function</strong><p id="dli_08_15090__p5462550153014">Returns the resulting date after adding a certain number of days to a specified date.</p>
|
|
</li><li id="dli_08_15090__li868493518477"><strong id="dli_08_15090__b153801351181717">Description</strong><pre class="screen" id="dli_08_15090__screen136844355474">DATE_ADD(string startdate, int days)</pre>
|
|
</li><li id="dli_08_15090__li17860153954420"><strong id="dli_08_15090__b39951954171715">Input parameters</strong><ul id="dli_08_15090__ul20193357124416"><li id="dli_08_15090__li1959195424415"><strong id="dli_08_15090__b18922159181819">startdate</strong>: specified date. The data type is <strong id="dli_08_15090__b76871933191819">TIMESTAMP</strong> or <strong id="dli_08_15090__b3342935121818">STRING</strong>.<div class="note" id="dli_08_15090__note047520572382"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="dli_08_15090__p8857172333813">The date format for the <strong id="dli_08_15090__b177862236194">STRING</strong> type is <strong id="dli_08_15090__b591351212199">yyyy-MM-dd HH:mm:ss</strong>.</p>
|
|
<p id="dli_08_15090__p8493936193912">The function supports the special case where this parameter value is <strong id="dli_08_15090__b890442810220">NULL</strong>.</p>
|
|
</div></div>
|
|
</li><li id="dli_08_15090__li5594195417443"><strong id="dli_08_15090__b16462193611223">days</strong>: target number of days. The data type is <strong id="dli_08_15090__b19791152817230">INT</strong>.</li></ul>
|
|
</li><li id="dli_08_15090__li64004911453"><strong id="dli_08_15090__b16158312239">Return values</strong><p id="dli_08_15090__p399817542517">Resulting date after adding a certain number of days to a specified date. The data type is <strong id="dli_08_15090__b15644123562313">STRING</strong>.</p>
|
|
</li><li id="dli_08_15090__li49751518154518"><strong id="dli_08_15090__b122773560232">Example</strong><div class="p" id="dli_08_15090__p7917202716456">Submit a Flink SQL statement.<pre class="screen" id="dli_08_15090__screen091719292099">CREATE TABLE source (
|
|
time1 TIMESTAMP
|
|
) WITH (
|
|
'connector' = 'datagen',
|
|
'rows-per-second' = '1'
|
|
);
|
|
create table Sink (
|
|
date1 string,
|
|
date2 string,
|
|
date3 string
|
|
) with ('connector' = 'print');
|
|
INSERT into
|
|
Sink
|
|
select
|
|
DATE_ADD(time1, 30) as date1,
|
|
DATE_ADD('2017-09-15 00:00:00', 30) as date2,
|
|
DATE_ADD(cast(null as timestamp),30) as date3
|
|
FROM source</pre>
|
|
</div>
|
|
<p id="dli_08_15090__p1541720180135">Test result</p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table1397919711514" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row119799719159"><th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.4.2.5.4.1.4.1.1"><p id="dli_08_15090__p5979378156"><strong id="dli_08_15090__b310731510160">date1 (string)</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.4.2.5.4.1.4.1.2"><p id="dli_08_15090__p3926165611519"><strong id="dli_08_15090__b41191815151614">date2 (string)</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.4.2.5.4.1.4.1.3"><p id="dli_08_15090__p777513051612"><strong id="dli_08_15090__b8133191541613">date3 (string)</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row1397910716151"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.4.2.5.4.1.4.1.1 "><p id="dli_08_15090__p179797731512">2024-06-28</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.4.2.5.4.1.4.1.2 "><p id="dli_08_15090__p69791977152">2017-10-15</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.4.2.5.4.1.4.1.3 "><p id="dli_08_15090__p13979117131519">null</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section1911043616439"><a name="dli_08_15090__section1911043616439"></a><a name="section1911043616439"></a><h4 class="sectiontitle">DATE_SUB</h4><ul id="dli_08_15090__ul1971195514"><li id="dli_08_15090__li3719195515"><strong id="dli_08_15090__b168491221131516">Function</strong><p id="dli_08_15090__p157141915113">Returns the resulting date after subtracting a certain number of days from a specified date.</p>
|
|
</li><li id="dli_08_15090__li1671219155117"><strong id="dli_08_15090__b92545331715">Description</strong><pre class="screen" id="dli_08_15090__screen1271519165110">DATE_SUB(string startdate, int days)</pre>
|
|
</li><li id="dli_08_15090__li075191512"><strong id="dli_08_15090__b109566111185">Input parameters</strong><ul id="dli_08_15090__ul77181955116"><li id="dli_08_15090__li571719125111"><strong id="dli_08_15090__b11491196113019">startdate</strong>: specified date. The data type is <strong id="dli_08_15090__b6491106173016">TIMESTAMP</strong> or <strong id="dli_08_15090__b144927663016">STRING</strong>.<div class="note" id="dli_08_15090__note1731925115"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="dli_08_15090__p1761912519">The date format for the <strong id="dli_08_15090__b16159292306">STRING</strong> type is <strong id="dli_08_15090__b12160139193014">yyyy-MM-dd HH:mm:ss</strong>.</p>
|
|
<p id="dli_08_15090__p974194516">The function supports the special case where this parameter value is <strong id="dli_08_15090__b0340131293019">NULL</strong>.</p>
|
|
</div></div>
|
|
</li><li id="dli_08_15090__li15741911511"><strong id="dli_08_15090__b2537115163019">days</strong>: target number of days. The data type is <strong id="dli_08_15090__b853711158303">INT</strong>.</li></ul>
|
|
</li><li id="dli_08_15090__li14781945111"><strong id="dli_08_15090__b127843349234">Return values</strong><p id="dli_08_15090__p08171985113">Resulting date after subtracting a certain number of days from a specified date. The data type is <strong id="dli_08_15090__b145781218193018">STRING</strong>.</p>
|
|
</li><li id="dli_08_15090__li3841916513"><strong id="dli_08_15090__b19395757132320">Example</strong><div class="p" id="dli_08_15090__p1817198511">Submit a Flink SQL statement.<pre class="screen" id="dli_08_15090__screen78181911519">CREATE TABLE source (
|
|
time1 TIMESTAMP
|
|
) WITH (
|
|
'connector' = 'datagen',
|
|
'rows-per-second' = '1'
|
|
);
|
|
create table Sink (
|
|
date1 string,
|
|
date2 string,
|
|
date3 string
|
|
) with ('connector' = 'print');
|
|
INSERT into
|
|
Sink
|
|
select
|
|
DATE_SUB(time1,30) as date1,
|
|
DATE_SUB('2017-09-15 00:00:00', 30) as date2,
|
|
DATE_SUB(cast(null as timestamp),30) as date3
|
|
FROM source</pre>
|
|
</div>
|
|
<p id="dli_08_15090__p28919165111">Test result</p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table1781119145115" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row1081119175115"><th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.5.2.5.4.1.4.1.1"><p id="dli_08_15090__p118121985120"><strong id="dli_08_15090__b198171935113">date1 (string)</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.5.2.5.4.1.4.1.2"><p id="dli_08_15090__p16831914511"><strong id="dli_08_15090__b281319135112">date2 (string)</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.5.2.5.4.1.4.1.3"><p id="dli_08_15090__p989198510"><strong id="dli_08_15090__b6811191518">date3 (string)</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row108201985116"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.5.2.5.4.1.4.1.1 "><p id="dli_08_15090__p1089914496194">2024-04-29</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.5.2.5.4.1.4.1.2 "><p id="dli_08_15090__p131991857131911">2017-08-16</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.5.2.5.4.1.4.1.3 "><p id="dli_08_15090__p3295199171711">null</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section360564211339"><a name="dli_08_15090__section360564211339"></a><a name="section360564211339"></a><h4 class="sectiontitle">TIME</h4><ul id="dli_08_15090__ul360504212331"><li id="dli_08_15090__li156051642113312"><strong id="dli_08_15090__b11605154213317">Function</strong><p id="dli_08_15090__p156021956173319">Returns a SQL time parsed from string in form of <strong id="dli_08_15090__b9107157125016">HH:mm:ss[.fff]</strong>.</p>
|
|
</li><li id="dli_08_15090__li11606042153313"><strong id="dli_08_15090__b56069429332">Description</strong><pre class="screen" id="dli_08_15090__screen860618424334">TIME <strong id="dli_08_15090__b1285712503482">TIME </strong>string</pre>
|
|
</li><li id="dli_08_15090__li06061342133312"><strong id="dli_08_15090__b5606144216337">Input parameters</strong>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table1067317317346" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row467373118349"><th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.6.2.3.2.1.4.1.1"><p id="dli_08_15090__p4673931173411">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.6.2.3.2.1.4.1.2"><p id="dli_08_15090__p867373103412">Data Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.6.2.3.2.1.4.1.3"><p id="dli_08_15090__p12673113133411">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row567343112348"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.6.2.3.2.1.4.1.1 "><p id="dli_08_15090__p18673331173419">string</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.6.2.3.2.1.4.1.2 "><p id="dli_08_15090__p567313118348">STRING</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.6.2.3.2.1.4.1.3 "><p id="dli_08_15090__p1067323114343">Time</p>
|
|
<p id="dli_08_15090__p7361130112517">Note that the string must be in the format of <strong id="dli_08_15090__b39366316573">HH:mm:ss[.fff]</strong>. Otherwise, an error will be reported.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="dli_08_15090__li560612429338"><strong id="dli_08_15090__b66061142143313">Example</strong><ul id="dli_08_15090__ul1260624223316"><li id="dli_08_15090__li1360694216331">Test statement<pre class="screen" id="dli_08_15090__screen206065428334">SELECT
|
|
TIME "10:11:12" AS `result`,
|
|
TIME "10:11:12.032" AS `result2`
|
|
FROM
|
|
testtable;</pre>
|
|
</li><li id="dli_08_15090__li960613424333">Test result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table86061442203312" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row16606174218335"><th align="left" class="cellrowborder" valign="top" width="22.99%" id="mcps1.3.6.2.4.2.2.1.1.3.1.1"><p id="dli_08_15090__p260619423337">result</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="77.01%" id="mcps1.3.6.2.4.2.2.1.1.3.1.2"><p id="dli_08_15090__p1790827113318">result2</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row1360664253315"><td class="cellrowborder" valign="top" width="22.99%" headers="mcps1.3.6.2.4.2.2.1.1.3.1.1 "><p id="dli_08_15090__p8606154214335">10:11:12</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="77.01%" headers="mcps1.3.6.2.4.2.2.1.1.3.1.2 "><p id="dli_08_15090__p1790811773316">10:11:12.032</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section1878994533516"><a name="dli_08_15090__section1878994533516"></a><a name="section1878994533516"></a><h4 class="sectiontitle">TIMESTAMP</h4><ul id="dli_08_15090__ul1979011458350"><li id="dli_08_15090__li197901345203511"><strong id="dli_08_15090__b1479074520353">Function</strong><p id="dli_08_15090__p1779074515352">Converts the time string into timestamp. The time string format is <strong id="dli_08_15090__b19107679464495">yyyy-MM-dd HH:mm:ss[.fff]</strong>. The return value is of the <strong id="dli_08_15090__b18985108094495">TIMESTAMP(3) </strong>type.</p>
|
|
</li><li id="dli_08_15090__li4790645173516"><strong id="dli_08_15090__b1679004543516">Description</strong><pre class="screen" id="dli_08_15090__screen3790144516358">TIMESTAMP(3) <strong id="dli_08_15090__b625655504810">TIMESTAMP </strong>string</pre>
|
|
</li><li id="dli_08_15090__li779012457353"><strong id="dli_08_15090__b177906454359">Input parameters</strong>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table1079084533515" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row0790204510355"><th align="left" class="cellrowborder" valign="top" width="27.34273427342734%" id="mcps1.3.7.2.3.2.1.4.1.1"><p id="dli_08_15090__p1679054512350">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="25.85258525852585%" id="mcps1.3.7.2.3.2.1.4.1.2"><p id="dli_08_15090__p079015451359">Data Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="46.804680468046804%" id="mcps1.3.7.2.3.2.1.4.1.3"><p id="dli_08_15090__p879018451351">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row9790145193517"><td class="cellrowborder" valign="top" width="27.34273427342734%" headers="mcps1.3.7.2.3.2.1.4.1.1 "><p id="dli_08_15090__p9999111618362">string</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="25.85258525852585%" headers="mcps1.3.7.2.3.2.1.4.1.2 "><p id="dli_08_15090__p1999131683615">STRING</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="46.804680468046804%" headers="mcps1.3.7.2.3.2.1.4.1.3 "><p id="dli_08_15090__p17999111693611">Time</p>
|
|
<p id="dli_08_15090__p5273104720470">Note that the string must be in the format of <strong id="dli_08_15090__b8918162425716">yyyy-MM-dd HH:mm:ss[.fff]</strong>. Otherwise, an error will be reported.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="dli_08_15090__li1779016458359"><strong id="dli_08_15090__b2790145103513">Example</strong><ul id="dli_08_15090__ul17790045103510"><li id="dli_08_15090__li679014543516">Test statement<pre class="screen" id="dli_08_15090__screen279024573510">SELECT
|
|
TIMESTAMP "1997-04-25 13:14:15" AS `result`,
|
|
TIMESTAMP "1997-04-25 13:14:15.032" AS `result2`
|
|
FROM
|
|
testtable;</pre>
|
|
</li><li id="dli_08_15090__li8790174553514">Test result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table1279094593511" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row1779084583519"><th align="left" class="cellrowborder" valign="top" width="31.900000000000002%" id="mcps1.3.7.2.4.2.2.1.1.3.1.1"><p id="dli_08_15090__p1279034510352">result</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="68.10000000000001%" id="mcps1.3.7.2.4.2.2.1.1.3.1.2"><p id="dli_08_15090__p62281849154017">result2</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row67901456357"><td class="cellrowborder" valign="top" width="31.900000000000002%" headers="mcps1.3.7.2.4.2.2.1.1.3.1.1 "><p id="dli_08_15090__p136111735113617">1997-04-25 13:14:15</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="68.10000000000001%" headers="mcps1.3.7.2.4.2.2.1.1.3.1.2 "><p id="dli_08_15090__p422818495408">1997-04-25 13:14:15.032</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section8680184819367"><a name="dli_08_15090__section8680184819367"></a><a name="section8680184819367"></a><h4 class="sectiontitle">INTERVAL</h4><ul id="dli_08_15090__ul1668117487366"><li id="dli_08_15090__li26811548103612"><strong id="dli_08_15090__b168115486367">Function</strong><p id="dli_08_15090__p18681548133616">Parses an interval string.</p>
|
|
</li><li id="dli_08_15090__li16814483367"><strong id="dli_08_15090__b06819485366">Description</strong><pre class="screen" id="dli_08_15090__screen868118481362">INTERVAL <strong id="dli_08_15090__b164101011492">INTERVAL </strong>string range</pre>
|
|
</li><li id="dli_08_15090__li1868194873616"><strong id="dli_08_15090__b9681248143614">Input parameters</strong>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table15381139153718" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row1138133993718"><th align="left" class="cellrowborder" valign="top" width="23.522352235223522%" id="mcps1.3.8.2.3.2.1.4.1.1"><p id="dli_08_15090__p133883910377">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="18.76187618761876%" id="mcps1.3.8.2.3.2.1.4.1.2"><p id="dli_08_15090__p1381139153714">Data Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="57.71577157715772%" id="mcps1.3.8.2.3.2.1.4.1.3"><p id="dli_08_15090__p19381039103719">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row173813399377"><td class="cellrowborder" valign="top" width="23.522352235223522%" headers="mcps1.3.8.2.3.2.1.4.1.1 "><p id="dli_08_15090__p33812398373">string</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="18.76187618761876%" headers="mcps1.3.8.2.3.2.1.4.1.2 "><p id="dli_08_15090__p53814391372">STRING</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.71577157715772%" headers="mcps1.3.8.2.3.2.1.4.1.3 "><p id="dli_08_15090__p638183911378">Timestamp string used together with the <strong id="dli_08_15090__b2056982264495">range</strong> parameter. The string is in either of the following two formats:</p>
|
|
<ul id="dli_08_15090__ul14137932161217"><li id="dli_08_15090__li18137232131219"><strong id="dli_08_15090__b3421508914495">yyyy-MM</strong> for SQL intervals of months. An interval range might be <strong id="dli_08_15090__b21285148994495">YEAR</strong> or<strong id="dli_08_15090__b10770982954495"> YEAR TO MONTH </strong>for intervals of months. </li><li id="dli_08_15090__li841674219503"><strong id="dli_08_15090__b1218483015599">dd hh:mm:ss.fff</strong> for SQL intervals of milliseconds. An interval range might be <strong id="dli_08_15090__b17410709344495">DAY</strong>, <strong id="dli_08_15090__b10850519194495">MINUTE</strong>, <strong id="dli_08_15090__b9530602254495">DAY TO HOUR</strong>, or <strong id="dli_08_15090__b17689758114495">DAY TO SECOND</strong>.</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row273614571912"><td class="cellrowborder" valign="top" width="23.522352235223522%" headers="mcps1.3.8.2.3.2.1.4.1.1 "><p id="dli_08_15090__p119468161010">range</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="18.76187618761876%" headers="mcps1.3.8.2.3.2.1.4.1.2 "><p id="dli_08_15090__p3101132031015">INTERVAL</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.71577157715772%" headers="mcps1.3.8.2.3.2.1.4.1.3 "><p id="dli_08_15090__p29167519529">Interval range. This parameter is used together with the <strong id="dli_08_15090__b19599124474495">string</strong> parameter. </p>
|
|
<p id="dli_08_15090__p17490112611119">Available values are as follows: <strong id="dli_08_15090__b2600784113">YEAR, YEAR To Month, DAY, MINUTE, DAY TO HOUR and DAY TO SECOND</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="dli_08_15090__li468164816369"><strong id="dli_08_15090__b5681124820367">Example</strong><div class="p" id="dli_08_15090__p972005514379">Test statement<pre class="screen" id="dli_08_15090__screen1968114819363">-- indicates that the interval is 10 days and 4 milliseconds.
|
|
INTERVAL '10 00:00:00.004' DAY TO second
|
|
-- The interval is 10 days.
|
|
INTERVAL '10'
|
|
-- The interval is 2 years and 10 months.
|
|
INTERVAL '2-10' YEAR TO MONTH</pre>
|
|
</div>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section17211159143814"><a name="dli_08_15090__section17211159143814"></a><a name="section17211159143814"></a><h4 class="sectiontitle">CURRENT_DATE</h4><ul id="dli_08_15090__ul621159193816"><li id="dli_08_15090__li921155913818"><strong id="dli_08_15090__b1121105913817">Function</strong><p id="dli_08_15090__p1921185914381">Returns the current SQL time (<strong id="dli_08_15090__b19882786664495">yyyy-MM-dd</strong>) in the local time zone. The return value is of the <strong id="dli_08_15090__b19802631934495">DATE </strong>type.</p>
|
|
</li><li id="dli_08_15090__li12111592382"><strong id="dli_08_15090__b1721559123810">Description</strong><pre class="screen" id="dli_08_15090__screen1521359193817">DATE <strong id="dli_08_15090__b8653201117556">CURRENT_DATE</strong></pre>
|
|
</li><li id="dli_08_15090__li4211459203816"><strong id="dli_08_15090__b192115595386">Input parameters</strong><p id="dli_08_15090__p336973224011">None</p>
|
|
</li><li id="dli_08_15090__li5211059193820"><strong id="dli_08_15090__b162225933818">Example</strong><ul id="dli_08_15090__ul19227599388"><li id="dli_08_15090__li7221159143810">Test statement<pre class="screen" id="dli_08_15090__screen1622175913813">SELECT
|
|
CURRENT_DATE AS `result`
|
|
FROM
|
|
testtable;</pre>
|
|
</li><li id="dli_08_15090__li1922959143814">Test result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table1222959143818" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row152235918385"><th align="left" class="cellrowborder" valign="top" width="100%" id="mcps1.3.9.2.4.2.2.1.1.2.1.1"><p id="dli_08_15090__p62235933818">result</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row522125983818"><td class="cellrowborder" valign="top" width="100%" headers="mcps1.3.9.2.4.2.2.1.1.2.1.1 "><p id="dli_08_15090__p7925115120405">2021-10-28</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section207768598406"><a name="dli_08_15090__section207768598406"></a><a name="section207768598406"></a><h4 class="sectiontitle">CURRENT_TIME</h4><ul id="dli_08_15090__ul1177611592403"><li id="dli_08_15090__li6776135954019"><strong id="dli_08_15090__b877645913402">Function</strong><p id="dli_08_15090__p7776759124012">Returns the current SQL time (<strong id="dli_08_15090__b20871742424495">HH:mm:sss.fff</strong>) in the local time zone. The return value is of the <strong id="dli_08_15090__b2066831044495">TIME</strong> type.</p>
|
|
</li><li id="dli_08_15090__li677614599406"><strong id="dli_08_15090__b27761359194010">Description</strong><pre class="screen" id="dli_08_15090__screen1577695954014">TIME <strong id="dli_08_15090__b9124847185420">CURRENT_TIME</strong></pre>
|
|
</li><li id="dli_08_15090__li1677618598407"><strong id="dli_08_15090__b187769590403">Input parameters</strong><p id="dli_08_15090__p147762595408">None</p>
|
|
</li><li id="dli_08_15090__li17776125954010"><strong id="dli_08_15090__b177685944016">Example</strong><ul id="dli_08_15090__ul15776185913406"><li id="dli_08_15090__li777645916408">Test statement<pre class="screen" id="dli_08_15090__screen6776135917404">SELECT
|
|
CURRENT_TIME AS `result`
|
|
FROM
|
|
testtable;</pre>
|
|
</li><li id="dli_08_15090__li77760591406">Test Result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table177766596402" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row18776165994014"><th align="left" class="cellrowborder" valign="top" width="100%" id="mcps1.3.10.2.4.2.2.1.1.2.1.1"><p id="dli_08_15090__p7776115915405">result</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row10776185917408"><td class="cellrowborder" valign="top" width="100%" headers="mcps1.3.10.2.4.2.2.1.1.2.1.1 "><p id="dli_08_15090__p2793164752014">08:29:19.289</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section17661335184515"><a name="dli_08_15090__section17661335184515"></a><a name="section17661335184515"></a><h4 class="sectiontitle">CURRENT_TIMESTAMP</h4><ul id="dli_08_15090__ul676623513459"><li id="dli_08_15090__li176613554514"><strong id="dli_08_15090__b19766113511459">Function</strong><p id="dli_08_15090__p776603514454">Returns the current SQL timestamp in the local time zone. The return value is of the <strong id="dli_08_15090__b17067260714495">TIMESTAMP(3)</strong> type.</p>
|
|
</li><li id="dli_08_15090__li476623594517"><strong id="dli_08_15090__b976623584516">Description</strong><pre class="screen" id="dli_08_15090__screen161621232095">TIMESTAMP(3) <strong id="dli_08_15090__b11708121615414">CURRENT_TIMESTAMP</strong></pre>
|
|
</li><li id="dli_08_15090__li876653594516"><strong id="dli_08_15090__b6767435144518">Input parameters</strong><p id="dli_08_15090__p1176733515454">None</p>
|
|
</li><li id="dli_08_15090__li1476715357452"><strong id="dli_08_15090__b0767123516451">Example</strong><ul id="dli_08_15090__ul14767203554511"><li id="dli_08_15090__li15767183574518">Test statement<pre class="screen" id="dli_08_15090__screen1776733516456">SELECT
|
|
CURRENT_TIMESTAMP AS `result`
|
|
FROM
|
|
testtable;</pre>
|
|
</li><li id="dli_08_15090__li5767173510459">Test Result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table1767335134516" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row5767143519454"><th align="left" class="cellrowborder" valign="top" width="100%" id="mcps1.3.11.2.4.2.2.1.1.2.1.1"><p id="dli_08_15090__p576773513454">result</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row1976733514515"><td class="cellrowborder" valign="top" width="100%" headers="mcps1.3.11.2.4.2.2.1.1.2.1.1 "><p id="dli_08_15090__p676713514517">2021-10-28 08:33:51.606</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section11477133554614"><a name="dli_08_15090__section11477133554614"></a><a name="section11477133554614"></a><h4 class="sectiontitle">LOCALTIME</h4><ul id="dli_08_15090__ul1447783510469"><li id="dli_08_15090__li1947773554613"><strong id="dli_08_15090__b124779357462">Function</strong><p id="dli_08_15090__p1223312517199">Returns the current SQL time in the local time zone. The return value is of the <strong id="dli_08_15090__b8883777394495">TIME</strong> type.</p>
|
|
</li><li id="dli_08_15090__li747733519463"><strong id="dli_08_15090__b2477133513466">Description</strong><pre class="screen" id="dli_08_15090__screen2477435164615">TIME <strong id="dli_08_15090__b11641271428">LOCALTIME</strong></pre>
|
|
</li><li id="dli_08_15090__li947733574613"><strong id="dli_08_15090__b18477735124617">Input parameters</strong><p id="dli_08_15090__p1647713514612">None</p>
|
|
</li><li id="dli_08_15090__li447783519461"><strong id="dli_08_15090__b14477183514618">Example</strong><ul id="dli_08_15090__ul24771335174610"><li id="dli_08_15090__li1547753514465">Test statement<pre class="screen" id="dli_08_15090__screen647718357460">SELECT
|
|
LOCALTIME AS `result`
|
|
FROM
|
|
testtable;</pre>
|
|
</li><li id="dli_08_15090__li947793594615">Test Result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table13477113510464" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row047713511464"><th align="left" class="cellrowborder" valign="top" width="100%" id="mcps1.3.12.2.4.2.2.1.1.2.1.1"><p id="dli_08_15090__p16477735164616">result</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row16477103534614"><td class="cellrowborder" valign="top" width="100%" headers="mcps1.3.12.2.4.2.2.1.1.2.1.1 "><p id="dli_08_15090__p1427461514472">16:39:37.706</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section14830142934817"><a name="dli_08_15090__section14830142934817"></a><a name="section14830142934817"></a><h4 class="sectiontitle">LOCALTIMESTAMP</h4><ul id="dli_08_15090__ul1283042915483"><li id="dli_08_15090__li19830829184814"><strong id="dli_08_15090__b138301029104812">Function</strong><p id="dli_08_15090__p3830132911482">Returns the current SQL timestamp in the local time zone. The return value is of the <strong id="dli_08_15090__b18337425674495">TIMESTAMP(3)</strong> type.</p>
|
|
</li><li id="dli_08_15090__li1983014295486"><strong id="dli_08_15090__b1883010290483">Description</strong><pre class="screen" id="dli_08_15090__screen68304297482">TIMESTAMP(3) <strong id="dli_08_15090__b1527731012541">LOCALTIMESTAMP</strong></pre>
|
|
</li><li id="dli_08_15090__li148301729124817"><strong id="dli_08_15090__b68307292486">Input parameters</strong><p id="dli_08_15090__p3830629164812">None</p>
|
|
</li><li id="dli_08_15090__li148301529144810"><strong id="dli_08_15090__b783032920482">Example</strong><ul id="dli_08_15090__ul1830132944811"><li id="dli_08_15090__li7830829104814">Test statement<pre class="screen" id="dli_08_15090__screen1830629154815">SELECT
|
|
LOCALTIMESTAMP AS `result`
|
|
FROM
|
|
testtable;</pre>
|
|
</li><li id="dli_08_15090__li9830192964817">Test Result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table19830152912485" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row168303297481"><th align="left" class="cellrowborder" valign="top" width="100%" id="mcps1.3.13.2.4.2.2.1.1.2.1.1"><p id="dli_08_15090__p7830152916489">result</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row383013296489"><td class="cellrowborder" valign="top" width="100%" headers="mcps1.3.13.2.4.2.2.1.1.2.1.1 "><p id="dli_08_15090__p6390455497">2021-10-28 16:43:17.625</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section184791718509"><a name="dli_08_15090__section184791718509"></a><a name="section184791718509"></a><h4 class="sectiontitle">EXTRACT</h4><ul id="dli_08_15090__ul1047217145017"><li id="dli_08_15090__li1247617155019"><strong id="dli_08_15090__b2473177501">Function</strong><p id="dli_08_15090__p19567854757">Returns a value extracted from the <strong id="dli_08_15090__b1732656784495">timeintervalunit</strong> part of temporal. The return value is of the <strong id="dli_08_15090__b12120996044495">BIGINT</strong> type.</p>
|
|
</li><li id="dli_08_15090__li54751785019"><strong id="dli_08_15090__b64713174509">Description</strong><pre class="screen" id="dli_08_15090__screen15471817185014">BIGINT <strong id="dli_08_15090__b167721838517">EXTRACT</strong>(timeinteravlunit <strong id="dli_08_15090__b124946851">FROM </strong>temporal)</pre>
|
|
</li><li id="dli_08_15090__li247717185010"><strong id="dli_08_15090__b3471717205011">Input parameters</strong>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table108661744165017" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row9866104419505"><th align="left" class="cellrowborder" valign="top" width="23.54235423542354%" id="mcps1.3.14.2.3.2.1.4.1.1"><p id="dli_08_15090__p20866204495018">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="21.912191219121908%" id="mcps1.3.14.2.3.2.1.4.1.2"><p id="dli_08_15090__p1086614455018">Data Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="54.54545454545454%" id="mcps1.3.14.2.3.2.1.4.1.3"><p id="dli_08_15090__p17866144115013">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row4866184412509"><td class="cellrowborder" valign="top" width="23.54235423542354%" headers="mcps1.3.14.2.3.2.1.4.1.1 "><p id="dli_08_15090__p14866174415014">timeinteravlunit</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="21.912191219121908%" headers="mcps1.3.14.2.3.2.1.4.1.2 "><p id="dli_08_15090__p1986614465019">TIMEUNIT</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="54.54545454545454%" headers="mcps1.3.14.2.3.2.1.4.1.3 "><p id="dli_08_15090__p68008411318">Time unit to be extracted from a time point or interval. The value can be <strong id="dli_08_15090__b19695467314495">YEAR</strong>, <strong id="dli_08_15090__b17784797904495">QUARTER</strong>, <strong id="dli_08_15090__b2229432564495">MONTH</strong>, <strong id="dli_08_15090__b8347935864495">WEEK</strong>, <strong id="dli_08_15090__b16751001884495">DAY</strong>, <strong id="dli_08_15090__b365431794495">DOY</strong>, <strong id="dli_08_15090__b11056608144495">HOUR</strong>, <strong id="dli_08_15090__b21408731204495">MINUTE</strong>, <strong id="dli_08_15090__b15581897434495">SECOND</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row128663449509"><td class="cellrowborder" valign="top" width="23.54235423542354%" headers="mcps1.3.14.2.3.2.1.4.1.1 "><p id="dli_08_15090__p38671844125011">temporal</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="21.912191219121908%" headers="mcps1.3.14.2.3.2.1.4.1.2 "><p id="dli_08_15090__p486714442509">DATE/TIME/TIMESTAMP/INTERVAL</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="54.54545454545454%" headers="mcps1.3.14.2.3.2.1.4.1.3 "><p id="dli_08_15090__p1092012183116">Time point or interval</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="caution" id="dli_08_15090__note660918595510"><span class="cautiontitle"><img src="public_sys-resources/caution_3.0-en-us.png"> </span><div class="cautionbody"><p id="dli_08_15090__p16094593515">Do not specify a time unit that is not of any time points or intervals. Otherwise, the job fails to be submitted.</p>
|
|
<p id="dli_08_15090__p186201523141318">For example, an error message is displayed when the following statement is executed because <strong id="dli_08_15090__b10879466594495">YEAR</strong> cannot be extracted from <strong id="dli_08_15090__b17932153324495">TIME</strong>.</p>
|
|
<pre class="screen" id="dli_08_15090__screen4240161971318">SELECT
|
|
EXTRACT(YEAR FROM TIME '12:44:31' ) AS `result`
|
|
FROM
|
|
testtable;</pre>
|
|
</div></div>
|
|
</li><li id="dli_08_15090__li2047121795018"><strong id="dli_08_15090__b174751718507">Example</strong><ul id="dli_08_15090__ul947217205010"><li id="dli_08_15090__li247151717502">Test statement<pre class="screen" id="dli_08_15090__screen114751718501">SELECT
|
|
EXTRACT(YEAR FROM DATE '1997-04-25' ) AS `result`,
|
|
EXTRACT(MINUTE FROM TIME '12:44:31') AS `result2`,
|
|
EXTRACT(SECOND FROM TIMESTAMP '1997-04-25 13:14:15') AS `result3`,
|
|
EXTRACT(YEAR FROM INTERVAL '2-10' YEAR TO MONTH) AS `result4`,
|
|
FROM
|
|
testtable;</pre>
|
|
</li><li id="dli_08_15090__li547111775016">Test result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table197512181539" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row1775171825311"><th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.14.2.4.2.2.1.1.5.1.1"><p id="dli_08_15090__p67511418135319">result</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.14.2.4.2.2.1.1.5.1.2"><p id="dli_08_15090__p7751181865316">result2</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.14.2.4.2.2.1.1.5.1.3"><p id="dli_08_15090__p147511718195316">result3</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.14.2.4.2.2.1.1.5.1.4"><p id="dli_08_15090__p1475181805317">result4</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row157511718165311"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.14.2.4.2.2.1.1.5.1.1 "><p id="dli_08_15090__p1875114183531">1997</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.14.2.4.2.2.1.1.5.1.2 "><p id="dli_08_15090__p575119183535">44</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.14.2.4.2.2.1.1.5.1.3 "><p id="dli_08_15090__p6751121835319">15</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.14.2.4.2.2.1.1.5.1.4 "><p id="dli_08_15090__p7751191835318">2</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section1643812191377"><a name="dli_08_15090__section1643812191377"></a><a name="section1643812191377"></a><h4 class="sectiontitle">YEAR</h4><ul id="dli_08_15090__ul104388197372"><li id="dli_08_15090__li10438719173718"><strong id="dli_08_15090__b19438619103714">Function</strong><p id="dli_08_15090__p184388192370">Returns the year from a SQL date date. The return value is of the <strong id="dli_08_15090__b6257369994495">BIGINT</strong> type.</p>
|
|
</li><li id="dli_08_15090__li11438141916371"><strong id="dli_08_15090__b6438111943717">Description</strong><pre class="screen" id="dli_08_15090__screen194381191375">BIGINT <strong id="dli_08_15090__b49013125179">YEAR</strong>(date)</pre>
|
|
</li><li id="dli_08_15090__li4438141923711"><strong id="dli_08_15090__b1438151923714">Input parameters</strong>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table3438171943719" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row34392198378"><th align="left" class="cellrowborder" valign="top" width="23.54235423542354%" id="mcps1.3.15.2.3.2.1.4.1.1"><p id="dli_08_15090__p18439419163720">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="18.74187418741874%" id="mcps1.3.15.2.3.2.1.4.1.2"><p id="dli_08_15090__p12439121915372">Data Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="57.71577157715772%" id="mcps1.3.15.2.3.2.1.4.1.3"><p id="dli_08_15090__p194391019123716">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row15439519173715"><td class="cellrowborder" valign="top" width="23.54235423542354%" headers="mcps1.3.15.2.3.2.1.4.1.1 "><p id="dli_08_15090__p143919198379">date</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="18.74187418741874%" headers="mcps1.3.15.2.3.2.1.4.1.2 "><p id="dli_08_15090__p543901913711">DATE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.71577157715772%" headers="mcps1.3.15.2.3.2.1.4.1.3 "><p id="dli_08_15090__p19439719203714">SQL date</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="dli_08_15090__li74395197374"><strong id="dli_08_15090__b9439319113718">Example</strong><ul id="dli_08_15090__ul1543961973712"><li id="dli_08_15090__li94391519163717">Test statement<pre class="screen" id="dli_08_15090__screen2439121917370">SELECT
|
|
YEAR(DATE '1997-04-25' ) AS `result`
|
|
FROM
|
|
testtable;</pre>
|
|
</li><li id="dli_08_15090__li743920195378">Test result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table124394191378" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row164391619143718"><th align="left" class="cellrowborder" valign="top" width="100%" id="mcps1.3.15.2.4.2.2.1.1.2.1.1"><p id="dli_08_15090__p11439119113713">result</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row344012196377"><td class="cellrowborder" valign="top" width="100%" headers="mcps1.3.15.2.4.2.2.1.1.2.1.1 "><p id="dli_08_15090__p04401819183713">1997</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section517261154017"><a name="dli_08_15090__section517261154017"></a><a name="section517261154017"></a><h4 class="sectiontitle">QUARTER</h4><ul id="dli_08_15090__ul1617241120406"><li id="dli_08_15090__li16172511194015"><strong id="dli_08_15090__b1172131134017">Function</strong><p id="dli_08_15090__p1917271115409">Returns the quarter of a year (an integer between 1 and 4) from a SQL date date. The return value is of the <strong id="dli_08_15090__b12549983204495">BIGINT</strong> type.</p>
|
|
</li><li id="dli_08_15090__li5172711164016"><strong id="dli_08_15090__b1317221194015">Description</strong><pre class="screen" id="dli_08_15090__screen17172611134015">BIGINT <strong id="dli_08_15090__b17353212185">QUARTER</strong>(date)</pre>
|
|
</li><li id="dli_08_15090__li1172511204014"><strong id="dli_08_15090__b6172111124020">Input parameters</strong>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table7172161114012" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row18172161164010"><th align="left" class="cellrowborder" valign="top" width="23.54235423542354%" id="mcps1.3.16.2.3.2.1.4.1.1"><p id="dli_08_15090__p31721511114020">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="18.74187418741874%" id="mcps1.3.16.2.3.2.1.4.1.2"><p id="dli_08_15090__p31721511184010">Data Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="57.71577157715772%" id="mcps1.3.16.2.3.2.1.4.1.3"><p id="dli_08_15090__p2172101124018">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row141721311104011"><td class="cellrowborder" valign="top" width="23.54235423542354%" headers="mcps1.3.16.2.3.2.1.4.1.1 "><p id="dli_08_15090__p1417312119405">date</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="18.74187418741874%" headers="mcps1.3.16.2.3.2.1.4.1.2 "><p id="dli_08_15090__p8173911114011">DATE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.71577157715772%" headers="mcps1.3.16.2.3.2.1.4.1.3 "><p id="dli_08_15090__p6173131111405">SQL date</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="dli_08_15090__li5173181110406"><strong id="dli_08_15090__b91733117408">Example</strong><ul id="dli_08_15090__ul14173101118408"><li id="dli_08_15090__li11735118408">Test statement<pre class="screen" id="dli_08_15090__screen14173141115400">SELECT
|
|
<strong id="dli_08_15090__b26071342171910">QUARTER</strong>(DATE '1997-04-25' ) AS `result`
|
|
FROM
|
|
testtable;</pre>
|
|
</li><li id="dli_08_15090__li617371154010">Test result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table917361164011" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row15173171111408"><th align="left" class="cellrowborder" valign="top" width="100%" id="mcps1.3.16.2.4.2.2.1.1.2.1.1"><p id="dli_08_15090__p15173161104016">result</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row19173121184015"><td class="cellrowborder" valign="top" width="100%" headers="mcps1.3.16.2.4.2.2.1.1.2.1.1 "><p id="dli_08_15090__p16173121119403">2</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section838818144523"><a name="dli_08_15090__section838818144523"></a><a name="section838818144523"></a><h4 class="sectiontitle">MONTH</h4><ul id="dli_08_15090__ul1438811145526"><li id="dli_08_15090__li1638811147526"><strong id="dli_08_15090__b838810142526">Function</strong><p id="dli_08_15090__p47331657122213">Returns the month of a year (an integer between 1 and 12) from a SQL date date. The return value is of the <strong id="dli_08_15090__b769711442117">BIGINT</strong> type.</p>
|
|
</li><li id="dli_08_15090__li8388314185218"><strong id="dli_08_15090__b43881914205214">Description</strong><pre class="screen" id="dli_08_15090__screen14388121465216">BIGINT <strong id="dli_08_15090__b171021729132311">MONTH</strong>(date)</pre>
|
|
</li><li id="dli_08_15090__li15388121455214"><strong id="dli_08_15090__b1838871405216">Input parameters</strong>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table163898146525" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row173891814115219"><th align="left" class="cellrowborder" valign="top" width="23.54235423542354%" id="mcps1.3.17.2.3.2.1.4.1.1"><p id="dli_08_15090__p133891514105216">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="18.74187418741874%" id="mcps1.3.17.2.3.2.1.4.1.2"><p id="dli_08_15090__p1838941412526">Data Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="57.71577157715772%" id="mcps1.3.17.2.3.2.1.4.1.3"><p id="dli_08_15090__p2389131410529">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row9389614165217"><td class="cellrowborder" valign="top" width="23.54235423542354%" headers="mcps1.3.17.2.3.2.1.4.1.1 "><p id="dli_08_15090__p138921475210">date</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="18.74187418741874%" headers="mcps1.3.17.2.3.2.1.4.1.2 "><p id="dli_08_15090__p93891714135219">DATE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.71577157715772%" headers="mcps1.3.17.2.3.2.1.4.1.3 "><p id="dli_08_15090__p103891914175210">SQL date</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="dli_08_15090__li12389131412522"><strong id="dli_08_15090__b9389111418523">Example</strong><ul id="dli_08_15090__ul9389111465216"><li id="dli_08_15090__li4389161415211">Test statement<pre class="screen" id="dli_08_15090__screen19389111465220">SELECT
|
|
MONTH(DATE '1997-04-25' ) AS `result`
|
|
FROM
|
|
testtable;</pre>
|
|
</li><li id="dli_08_15090__li738917148523">Test result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table1338961419522" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row1338971415210"><th align="left" class="cellrowborder" valign="top" width="100%" id="mcps1.3.17.2.4.2.2.1.1.2.1.1"><p id="dli_08_15090__p1438971411529">result</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row1338931425217"><td class="cellrowborder" valign="top" width="100%" headers="mcps1.3.17.2.4.2.2.1.1.2.1.1 "><p id="dli_08_15090__p113891814145220">4</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section08692035515"><a name="dli_08_15090__section08692035515"></a><a name="section08692035515"></a><h4 class="sectiontitle">WEEK</h4><ul id="dli_08_15090__ul178709045513"><li id="dli_08_15090__li158701408557"><strong id="dli_08_15090__b158709025510">Function</strong><p id="dli_08_15090__p158701401550">Returns the week of a year from a SQL date date. The return value is of the <strong id="dli_08_15090__b403818714495">BIGINT</strong> type.</p>
|
|
</li><li id="dli_08_15090__li1587080135515"><strong id="dli_08_15090__b15870110125515">Description</strong><pre class="screen" id="dli_08_15090__screen208701303559">BIGINT <strong id="dli_08_15090__b1168717109248">WEEK</strong>(date)</pre>
|
|
</li><li id="dli_08_15090__li138701500556"><strong id="dli_08_15090__b2870100195519">Input parameters</strong>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table3870801556" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row1870803557"><th align="left" class="cellrowborder" valign="top" width="23.54235423542354%" id="mcps1.3.18.2.3.2.1.4.1.1"><p id="dli_08_15090__p138701002553">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="18.74187418741874%" id="mcps1.3.18.2.3.2.1.4.1.2"><p id="dli_08_15090__p787013065515">Data Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="57.71577157715772%" id="mcps1.3.18.2.3.2.1.4.1.3"><p id="dli_08_15090__p5870120145513">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row1187014018557"><td class="cellrowborder" valign="top" width="23.54235423542354%" headers="mcps1.3.18.2.3.2.1.4.1.1 "><p id="dli_08_15090__p9870130195512">date</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="18.74187418741874%" headers="mcps1.3.18.2.3.2.1.4.1.2 "><p id="dli_08_15090__p78701016559">DATE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.71577157715772%" headers="mcps1.3.18.2.3.2.1.4.1.3 "><p id="dli_08_15090__p587017075514">SQL date</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="dli_08_15090__li118701602556"><strong id="dli_08_15090__b15870100165513">Example</strong><ul id="dli_08_15090__ul10870705557"><li id="dli_08_15090__li08711000551">Test statement<pre class="screen" id="dli_08_15090__screen118711408551">SELECT
|
|
WEEK(DATE '1997-04-25' ) AS `result`
|
|
FROM
|
|
testtable;</pre>
|
|
</li><li id="dli_08_15090__li168713012554">Test result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table087170175517" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row3871603556"><th align="left" class="cellrowborder" valign="top" width="100%" id="mcps1.3.18.2.4.2.2.1.1.2.1.1"><p id="dli_08_15090__p4871303554">result</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row28714012559"><td class="cellrowborder" valign="top" width="100%" headers="mcps1.3.18.2.4.2.2.1.1.2.1.1 "><p id="dli_08_15090__p158718065518">17</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section35952273562"><a name="dli_08_15090__section35952273562"></a><a name="section35952273562"></a><h4 class="sectiontitle">DAYOFYEAR</h4><ul id="dli_08_15090__ul10595192735618"><li id="dli_08_15090__li159542745619"><strong id="dli_08_15090__b859518274568">Function</strong><p id="dli_08_15090__p781110132250">Returns the day of a year (an integer between 1 and 366) from SQL date date. The return value is of the <strong id="dli_08_15090__b4121053294495">BIGINT</strong> type.</p>
|
|
</li><li id="dli_08_15090__li45951827145617"><strong id="dli_08_15090__b1459582719564">Description</strong><pre class="screen" id="dli_08_15090__screen13595102711561">BIGINT <strong id="dli_08_15090__b126851541162514">DAYOFYEAR</strong>(date)</pre>
|
|
</li><li id="dli_08_15090__li165959272560"><strong id="dli_08_15090__b2595127135610">Input parameters</strong>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table4595122785617" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row15596102735614"><th align="left" class="cellrowborder" valign="top" width="23.54235423542354%" id="mcps1.3.19.2.3.2.1.4.1.1"><p id="dli_08_15090__p159652715563">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="18.74187418741874%" id="mcps1.3.19.2.3.2.1.4.1.2"><p id="dli_08_15090__p135961727155619">Data Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="57.71577157715772%" id="mcps1.3.19.2.3.2.1.4.1.3"><p id="dli_08_15090__p559622715614">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row0596182735620"><td class="cellrowborder" valign="top" width="23.54235423542354%" headers="mcps1.3.19.2.3.2.1.4.1.1 "><p id="dli_08_15090__p35964276563">date</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="18.74187418741874%" headers="mcps1.3.19.2.3.2.1.4.1.2 "><p id="dli_08_15090__p115961227175613">DATE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.71577157715772%" headers="mcps1.3.19.2.3.2.1.4.1.3 "><p id="dli_08_15090__p459602725618">SQL date</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="dli_08_15090__li15596122785617"><strong id="dli_08_15090__b7596152725614">Example</strong><ul id="dli_08_15090__ul0596142717564"><li id="dli_08_15090__li15596327155619">Test statement<pre class="screen" id="dli_08_15090__screen5596162735615">SELECT
|
|
DAYOFYEAR(DATE '1997-04-25' ) AS `result`
|
|
FROM
|
|
testtable;</pre>
|
|
</li><li id="dli_08_15090__li13596827135616">Test Result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table759642711564" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row3596142715612"><th align="left" class="cellrowborder" valign="top" width="100%" id="mcps1.3.19.2.4.2.2.1.1.2.1.1"><p id="dli_08_15090__p1159612275561">result</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row18596122711567"><td class="cellrowborder" valign="top" width="100%" headers="mcps1.3.19.2.4.2.2.1.1.2.1.1 "><p id="dli_08_15090__p16596202775617">115</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section89188327592"><a name="dli_08_15090__section89188327592"></a><a name="section89188327592"></a><h4 class="sectiontitle">DAYOFMONTH</h4><ul id="dli_08_15090__ul791873212596"><li id="dli_08_15090__li991823275911"><strong id="dli_08_15090__b11918232145917">Function</strong><p id="dli_08_15090__p7918732195910">Returns the day of a month (an integer between 1 and 31) from a SQL date date. The return value is of the <strong id="dli_08_15090__b5189429974495">BIGINT</strong> type.</p>
|
|
</li><li id="dli_08_15090__li169181532155916"><strong id="dli_08_15090__b7918232195910">Description</strong><pre class="screen" id="dli_08_15090__screen19918332135916">BIGINT <strong id="dli_08_15090__b555142214261">DAYOFMONTH</strong>(date)</pre>
|
|
</li><li id="dli_08_15090__li791919327596"><strong id="dli_08_15090__b29191432205911">Input parameters</strong>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table4919153217591" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row16919133211599"><th align="left" class="cellrowborder" valign="top" width="23.54235423542354%" id="mcps1.3.20.2.3.2.1.4.1.1"><p id="dli_08_15090__p15919032155915">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="18.74187418741874%" id="mcps1.3.20.2.3.2.1.4.1.2"><p id="dli_08_15090__p149191132145918">Data Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="57.71577157715772%" id="mcps1.3.20.2.3.2.1.4.1.3"><p id="dli_08_15090__p16919432175915">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row5919163215596"><td class="cellrowborder" valign="top" width="23.54235423542354%" headers="mcps1.3.20.2.3.2.1.4.1.1 "><p id="dli_08_15090__p17919203285919">date</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="18.74187418741874%" headers="mcps1.3.20.2.3.2.1.4.1.2 "><p id="dli_08_15090__p1491918327590">DATE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.71577157715772%" headers="mcps1.3.20.2.3.2.1.4.1.3 "><p id="dli_08_15090__p191993295913">SQL date</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="dli_08_15090__li139191732145914"><strong id="dli_08_15090__b39197323594">Example</strong><ul id="dli_08_15090__ul6919143214594"><li id="dli_08_15090__li10919632175912">Test statement<pre class="screen" id="dli_08_15090__screen1919123265919">SELECT
|
|
DAYOFMONTH(DATE '1997-04-25' ) AS `result`
|
|
FROM
|
|
testtable;</pre>
|
|
</li><li id="dli_08_15090__li99198323597">Test Result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table6919163212593" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row5919143210599"><th align="left" class="cellrowborder" valign="top" width="100%" id="mcps1.3.20.2.4.2.2.1.1.2.1.1"><p id="dli_08_15090__p1591973285920">result</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row9920113235919"><td class="cellrowborder" valign="top" width="100%" headers="mcps1.3.20.2.4.2.2.1.1.2.1.1 "><p id="dli_08_15090__p8920173211596">25</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section152759367121"><a name="dli_08_15090__section152759367121"></a><a name="section152759367121"></a><h4 class="sectiontitle">DAYOFWEEK</h4><ul id="dli_08_15090__ul15275183621220"><li id="dli_08_15090__li42751136171212"><strong id="dli_08_15090__b1327513621216">Function</strong><p id="dli_08_15090__p71006464268">Returns the day of a week (an integer between 1 and 7) from a SQL date date. The return value is of the <strong id="dli_08_15090__b5795739984495">BIGINT</strong> type.</p>
|
|
<div class="note" id="dli_08_15090__note2414151182612"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="dli_08_15090__p10275836161219">Note that the start day of a week is Sunday. </p>
|
|
</div></div>
|
|
</li><li id="dli_08_15090__li11275536181219"><strong id="dli_08_15090__b15275163615128">Description</strong><pre class="screen" id="dli_08_15090__screen927518364127">BIGINT <strong id="dli_08_15090__b2385149102714">DAYOFWEEK</strong>(date)</pre>
|
|
</li><li id="dli_08_15090__li42752036161210"><strong id="dli_08_15090__b7275143616125">Input parameters</strong>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table127516362121" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row327543631218"><th align="left" class="cellrowborder" valign="top" width="23.54235423542354%" id="mcps1.3.21.2.3.2.1.4.1.1"><p id="dli_08_15090__p627553691211">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="18.74187418741874%" id="mcps1.3.21.2.3.2.1.4.1.2"><p id="dli_08_15090__p727573612120">Data Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="57.71577157715772%" id="mcps1.3.21.2.3.2.1.4.1.3"><p id="dli_08_15090__p0275436101214">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row1927513363125"><td class="cellrowborder" valign="top" width="23.54235423542354%" headers="mcps1.3.21.2.3.2.1.4.1.1 "><p id="dli_08_15090__p13275103651220">date</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="18.74187418741874%" headers="mcps1.3.21.2.3.2.1.4.1.2 "><p id="dli_08_15090__p727603631211">DATE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.71577157715772%" headers="mcps1.3.21.2.3.2.1.4.1.3 "><p id="dli_08_15090__p52764369127">SQL date</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="dli_08_15090__li8276153618123"><strong id="dli_08_15090__b9276133612125">Example</strong><ul id="dli_08_15090__ul2027623681212"><li id="dli_08_15090__li9276183661216">Test statement<pre class="screen" id="dli_08_15090__screen122764364127">SELECT
|
|
DAYOFWEEK(DATE '1997-04-25') AS `result`
|
|
FROM
|
|
testtable;</pre>
|
|
</li><li id="dli_08_15090__li52761636181220">Test Result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table4276103621216" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row112762036181220"><th align="left" class="cellrowborder" valign="top" width="100%" id="mcps1.3.21.2.4.2.2.1.1.2.1.1"><p id="dli_08_15090__p17276143617120">result</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row1027643671220"><td class="cellrowborder" valign="top" width="100%" headers="mcps1.3.21.2.4.2.2.1.1.2.1.1 "><p id="dli_08_15090__p1427613361129">6</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section34301613121413"><a name="dli_08_15090__section34301613121413"></a><a name="section34301613121413"></a><h4 class="sectiontitle">HOUR</h4><ul id="dli_08_15090__ul144308137147"><li id="dli_08_15090__li1043041313143"><strong id="dli_08_15090__b043041316141">Function</strong><p id="dli_08_15090__p4430151301411">Returns the hour of a day (an integer between 0 and 23) from SQL timestamp timestamp. The return value is of the <strong id="dli_08_15090__b16444222174495">BIGINT</strong> type.</p>
|
|
</li><li id="dli_08_15090__li1143071371414"><strong id="dli_08_15090__b543041314140">Description</strong><pre class="screen" id="dli_08_15090__screen184300133145">BIGINT <strong id="dli_08_15090__b17823427288">HOUR</strong>(timestamp)</pre>
|
|
</li><li id="dli_08_15090__li2430181310148"><strong id="dli_08_15090__b194311013141415">Input parameters</strong>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table17431201321418" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row18431131313144"><th align="left" class="cellrowborder" valign="top" width="23.54235423542354%" id="mcps1.3.22.2.3.2.1.4.1.1"><p id="dli_08_15090__p2431101371417">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="18.731873187318733%" id="mcps1.3.22.2.3.2.1.4.1.2"><p id="dli_08_15090__p16431713201418">Data Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="57.72577257725773%" id="mcps1.3.22.2.3.2.1.4.1.3"><p id="dli_08_15090__p11431101319149">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row18431101312145"><td class="cellrowborder" valign="top" width="23.54235423542354%" headers="mcps1.3.22.2.3.2.1.4.1.1 "><p id="dli_08_15090__p1543112137143">timestamp</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="18.731873187318733%" headers="mcps1.3.22.2.3.2.1.4.1.2 "><p id="dli_08_15090__p1431131311144">TIMESTAMP</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.72577257725773%" headers="mcps1.3.22.2.3.2.1.4.1.3 "><p id="dli_08_15090__p1443181315145">SQL timestamp</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="dli_08_15090__li19431101361412"><strong id="dli_08_15090__b13431181391418">Example</strong><ul id="dli_08_15090__ul1243131381410"><li id="dli_08_15090__li043131314146">Test statement<pre class="screen" id="dli_08_15090__screen94311413111420">SELECT
|
|
HOUR(TIMESTAMP '1997-04-25 10:11:12') AS `result`
|
|
FROM
|
|
testtable;</pre>
|
|
</li><li id="dli_08_15090__li1431191331415">Test Result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table9431913171415" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row943171311143"><th align="left" class="cellrowborder" valign="top" width="100%" id="mcps1.3.22.2.4.2.2.1.1.2.1.1"><p id="dli_08_15090__p9432713131412">result</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row1543291320145"><td class="cellrowborder" valign="top" width="100%" headers="mcps1.3.22.2.4.2.2.1.1.2.1.1 "><p id="dli_08_15090__p13432121341420">10</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section17296191222215"><a name="dli_08_15090__section17296191222215"></a><a name="section17296191222215"></a><h4 class="sectiontitle">MINUTE</h4><ul id="dli_08_15090__ul9296171210226"><li id="dli_08_15090__li1329614128226"><strong id="dli_08_15090__b1829618128222">Function</strong><p id="dli_08_15090__p1929619122220">Returns the minute of an hour (an integer between 0 and 59) from a SQL timestamp. The return value is of the <strong id="dli_08_15090__b20016362474495">BIGINT</strong> type.</p>
|
|
</li><li id="dli_08_15090__li729615122220"><strong id="dli_08_15090__b42961412192214">Description</strong><pre class="screen" id="dli_08_15090__screen12971412152217">BIGINT <strong id="dli_08_15090__b992111134301">MINUTE</strong>(timestamp)</pre>
|
|
</li><li id="dli_08_15090__li1629771222214"><strong id="dli_08_15090__b4297191210227">Input parameters</strong>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table1429712128221" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row19297161292219"><th align="left" class="cellrowborder" valign="top" width="23.54235423542354%" id="mcps1.3.23.2.3.2.1.4.1.1"><p id="dli_08_15090__p182972123229">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="18.731873187318733%" id="mcps1.3.23.2.3.2.1.4.1.2"><p id="dli_08_15090__p2029712124225">Data Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="57.72577257725773%" id="mcps1.3.23.2.3.2.1.4.1.3"><p id="dli_08_15090__p102971312162212">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row102971712122217"><td class="cellrowborder" valign="top" width="23.54235423542354%" headers="mcps1.3.23.2.3.2.1.4.1.1 "><p id="dli_08_15090__p11297171222215">timestamp</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="18.731873187318733%" headers="mcps1.3.23.2.3.2.1.4.1.2 "><p id="dli_08_15090__p1229701218222">TIMESTAMP</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.72577257725773%" headers="mcps1.3.23.2.3.2.1.4.1.3 "><p id="dli_08_15090__p10297912102218">SQL timestamp</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="dli_08_15090__li32971112132218"><strong id="dli_08_15090__b1229741222216">Example</strong><ul id="dli_08_15090__ul182971612102213"><li id="dli_08_15090__li8297111212229">Test statement<pre class="screen" id="dli_08_15090__screen4297112152219">SELECT
|
|
MINUTE(TIMESTAMP '1997-04-25 10:11:12') AS `result`
|
|
FROM
|
|
testtable;</pre>
|
|
</li><li id="dli_08_15090__li1297012202214">Test Result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table1029812123222" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row229819121225"><th align="left" class="cellrowborder" valign="top" width="100%" id="mcps1.3.23.2.4.2.2.1.1.2.1.1"><p id="dli_08_15090__p122983125225">result</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row1329881232213"><td class="cellrowborder" valign="top" width="100%" headers="mcps1.3.23.2.4.2.2.1.1.2.1.1 "><p id="dli_08_15090__p112980123223">11</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section125214317232"><a name="dli_08_15090__section125214317232"></a><a name="section125214317232"></a><h4 class="sectiontitle">SECOND</h4><ul id="dli_08_15090__ul17252183117235"><li id="dli_08_15090__li202525315237"><strong id="dli_08_15090__b14252183162310">Function</strong><p id="dli_08_15090__p12252431112317">Returns the second of an hour (an integer between 0 and 59) from a SQL timestamp. The return value is of the <strong id="dli_08_15090__b4815084204495">BIGINT</strong> type.</p>
|
|
</li><li id="dli_08_15090__li162521131122319"><strong id="dli_08_15090__b13252153118238">Description</strong><pre class="screen" id="dli_08_15090__screen7252163112238">BIGINT <strong id="dli_08_15090__b17800193393018">SECOND</strong>(timestamp)</pre>
|
|
</li><li id="dli_08_15090__li192521831162319"><strong id="dli_08_15090__b4252153112319">Input parameters</strong>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table12252133172316" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row112527311239"><th align="left" class="cellrowborder" valign="top" width="23.54235423542354%" id="mcps1.3.24.2.3.2.1.4.1.1"><p id="dli_08_15090__p1125211319236">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="18.731873187318733%" id="mcps1.3.24.2.3.2.1.4.1.2"><p id="dli_08_15090__p6252431172319">Data Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="57.72577257725773%" id="mcps1.3.24.2.3.2.1.4.1.3"><p id="dli_08_15090__p1125373112320">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row12531631162319"><td class="cellrowborder" valign="top" width="23.54235423542354%" headers="mcps1.3.24.2.3.2.1.4.1.1 "><p id="dli_08_15090__p1225363113235">timestamp</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="18.731873187318733%" headers="mcps1.3.24.2.3.2.1.4.1.2 "><p id="dli_08_15090__p625319311235">TIMESTAMP</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.72577257725773%" headers="mcps1.3.24.2.3.2.1.4.1.3 "><p id="dli_08_15090__p4253031132310">SQL timestamp</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="dli_08_15090__li10253193142315"><strong id="dli_08_15090__b325333117235">Example</strong><ul id="dli_08_15090__ul15253163112238"><li id="dli_08_15090__li10253133110234">Test statement<pre class="screen" id="dli_08_15090__screen725333112320">SELECT
|
|
SECOND(TIMESTAMP '1997-04-25 10:11:12') AS `result`
|
|
FROM
|
|
testtable;</pre>
|
|
</li><li id="dli_08_15090__li9253123118236">Test result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table152531331182314" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row4253831132320"><th align="left" class="cellrowborder" valign="top" width="100%" id="mcps1.3.24.2.4.2.2.1.1.2.1.1"><p id="dli_08_15090__p17253143162312">result</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row525373122313"><td class="cellrowborder" valign="top" width="100%" headers="mcps1.3.24.2.4.2.2.1.1.2.1.1 "><p id="dli_08_15090__p625320315238">12</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section114922047182416"><a name="dli_08_15090__section114922047182416"></a><a name="section114922047182416"></a><h4 class="sectiontitle">FLOOR</h4><ul id="dli_08_15090__ul749264710241"><li id="dli_08_15090__li6492164772418"><strong id="dli_08_15090__b15492847142413">Function</strong><p id="dli_08_15090__p14492747132415">Returns a value that rounds <strong id="dli_08_15090__b13520027654495">timepoint</strong> down to the time unit <strong id="dli_08_15090__b13566497414495">timeintervalunit</strong>.</p>
|
|
</li><li id="dli_08_15090__li6492144722417"><strong id="dli_08_15090__b5492204722412">Description</strong><pre class="screen" id="dli_08_15090__screen8492547172416">TIME/TIMESTAMP(3) <strong id="dli_08_15090__b2083175443016">FLOOR</strong>(timepoint <strong id="dli_08_15090__b4801458173010">TO </strong>timeintervalunit)</pre>
|
|
</li><li id="dli_08_15090__li1149254752411"><strong id="dli_08_15090__b11492447122415">Input parameters</strong>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table3492154742419" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row12493547112412"><th align="left" class="cellrowborder" valign="top" width="23.54235423542354%" id="mcps1.3.25.2.3.2.1.4.1.1"><p id="dli_08_15090__p5493144720249">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="18.731873187318733%" id="mcps1.3.25.2.3.2.1.4.1.2"><p id="dli_08_15090__p449324710241">Data Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="57.72577257725773%" id="mcps1.3.25.2.3.2.1.4.1.3"><p id="dli_08_15090__p2049334762420">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row144932047162415"><td class="cellrowborder" valign="top" width="23.54235423542354%" headers="mcps1.3.25.2.3.2.1.4.1.1 "><p id="dli_08_15090__p144931647102414">timepoint</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="18.731873187318733%" headers="mcps1.3.25.2.3.2.1.4.1.2 "><p id="dli_08_15090__p2493184718249">TIMESTAMP/TIME</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.72577257725773%" headers="mcps1.3.25.2.3.2.1.4.1.3 "><p id="dli_08_15090__p174931547162413">SQL time or SQL timestamp</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row842517722710"><td class="cellrowborder" valign="top" width="23.54235423542354%" headers="mcps1.3.25.2.3.2.1.4.1.1 "><p id="dli_08_15090__p042527172710">timeintervalunit</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="18.731873187318733%" headers="mcps1.3.25.2.3.2.1.4.1.2 "><p id="dli_08_15090__p84251578275">TIMEUNIT</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.72577257725773%" headers="mcps1.3.25.2.3.2.1.4.1.3 "><p id="dli_08_15090__p3425127182716">Time unit. The value can be <strong id="dli_08_15090__b17599935794495">YEAR</strong>, <strong id="dli_08_15090__b17091290944495">QUARTER</strong>, <strong id="dli_08_15090__b7387599174495">MONTH</strong>, <strong id="dli_08_15090__b8975771304495">WEEK</strong>, <strong id="dli_08_15090__b17404971284495">DAY</strong>, <strong id="dli_08_15090__b20732156364495">DOY</strong>, <strong id="dli_08_15090__b3327628714495">HOUR</strong>, <strong id="dli_08_15090__b15082348874495">MINUTE</strong>, or <strong id="dli_08_15090__b13647114114495">SECOND</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="dli_08_15090__li124937471247"><strong id="dli_08_15090__b6493147192415">Example</strong><ul id="dli_08_15090__ul349364714249"><li id="dli_08_15090__li12493114717246">Test statement<pre class="screen" id="dli_08_15090__screen14493114720246">SELECT
|
|
FLOOR(TIME '13:14:15' TO MINUTE) AS `result`
|
|
FLOOR(TIMESTAMP '1997-04-25 13:14:15' TO MINUTE) AS `result2`,
|
|
FLOOR(TIMESTAMP '1997-04-25 13:14:15' TO MINUTE) AS `result3`
|
|
FROM testtable;</pre>
|
|
</li><li id="dli_08_15090__li249316478241">Test result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table877311711558" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row1477216717553"><th align="left" class="cellrowborder" valign="top" width="20.18%" id="mcps1.3.25.2.4.2.2.1.1.4.1.1"><p id="dli_08_15090__p57721715558">message</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="27.439999999999998%" id="mcps1.3.25.2.4.2.2.1.1.4.1.2"><p id="dli_08_15090__p15772157155516">message2</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="52.38%" id="mcps1.3.25.2.4.2.2.1.1.4.1.3"><p id="dli_08_15090__p2853124110559">message3</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row2773177175511"><td class="cellrowborder" valign="top" width="20.18%" headers="mcps1.3.25.2.4.2.2.1.1.4.1.1 "><p id="dli_08_15090__p4772117195517">13:14</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="27.439999999999998%" headers="mcps1.3.25.2.4.2.2.1.1.4.1.2 "><p id="dli_08_15090__p1977213735513">13:14</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="52.38%" headers="mcps1.3.25.2.4.2.2.1.1.4.1.3 "><p id="dli_08_15090__p16853154119552">1997-04-25T13:14</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section345282814439"><a name="dli_08_15090__section345282814439"></a><a name="section345282814439"></a><h4 class="sectiontitle">CEIL</h4><ul id="dli_08_15090__ul1645212815437"><li id="dli_08_15090__li3452828154313"><strong id="dli_08_15090__b64531328114318">Function</strong><p id="dli_08_15090__p164531828164311">Returns a value that rounds <strong id="dli_08_15090__b9630123034495">timepoint</strong> up to the time unit <strong id="dli_08_15090__b8793513034495">timeintervalunit</strong>.</p>
|
|
</li><li id="dli_08_15090__li144539283433"><strong id="dli_08_15090__b1453102894318">Description</strong><pre class="screen" id="dli_08_15090__screen54538284439">TIME/TIMESTAMP(3) <strong id="dli_08_15090__b119671548380">CEIL</strong>(timepoint <strong id="dli_08_15090__b20635271388">TO </strong>timeintervalunit)</pre>
|
|
</li><li id="dli_08_15090__li94537284433"><strong id="dli_08_15090__b1045342814310">Input parameters</strong>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table1445362814316" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row20453828154316"><th align="left" class="cellrowborder" valign="top" width="23.54235423542354%" id="mcps1.3.26.2.3.2.1.4.1.1"><p id="dli_08_15090__p1445312824310">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="18.731873187318733%" id="mcps1.3.26.2.3.2.1.4.1.2"><p id="dli_08_15090__p11453112894312">Data Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="57.72577257725773%" id="mcps1.3.26.2.3.2.1.4.1.3"><p id="dli_08_15090__p13453162854317">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row17453728194315"><td class="cellrowborder" valign="top" width="23.54235423542354%" headers="mcps1.3.26.2.3.2.1.4.1.1 "><p id="dli_08_15090__p1745392854316">timepoint</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="18.731873187318733%" headers="mcps1.3.26.2.3.2.1.4.1.2 "><p id="dli_08_15090__p1745318287437">TIMESTAMP/TIME</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.72577257725773%" headers="mcps1.3.26.2.3.2.1.4.1.3 "><p id="dli_08_15090__p245312283435">SQL time or SQL timestamp</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row7453328184312"><td class="cellrowborder" valign="top" width="23.54235423542354%" headers="mcps1.3.26.2.3.2.1.4.1.1 "><p id="dli_08_15090__p14531428144313">timeintervalunit</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="18.731873187318733%" headers="mcps1.3.26.2.3.2.1.4.1.2 "><p id="dli_08_15090__p94531281437">TIMEUNIT</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.72577257725773%" headers="mcps1.3.26.2.3.2.1.4.1.3 "><p id="dli_08_15090__p3454182818435">Time unit. The value can be <strong id="dli_08_15090__b3594005904495">YEAR</strong>, <strong id="dli_08_15090__b14209291474495">QUARTER</strong>, <strong id="dli_08_15090__b2034812764495">MONTH</strong>, <strong id="dli_08_15090__b2397364584495">WEEK</strong>, <strong id="dli_08_15090__b20798002494495">DAY</strong>, <strong id="dli_08_15090__b5765014524495">DOY</strong>, <strong id="dli_08_15090__b7037642834495">HOUR</strong>, <strong id="dli_08_15090__b20102663134495">MINUTE</strong>, or <strong id="dli_08_15090__b8930543294495">SECOND</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="dli_08_15090__li15454132864312"><strong id="dli_08_15090__b345410285436">Example</strong><ul id="dli_08_15090__ul2454328134312"><li id="dli_08_15090__li4454728124318">Test statement<pre class="screen" id="dli_08_15090__screen1345415283430">SELECT
|
|
CEIL(TIME '13:14:15' TO MINUTE) AS `result`
|
|
CEIL(TIMESTAMP '1997-04-25 13:14:15' TO MINUTE) AS `result2`,
|
|
CEIL(TIMESTAMP '1997-04-25 13:14:15' TO MINUTE) AS `result3`
|
|
FROM testtable;</pre>
|
|
</li><li id="dli_08_15090__li18454192814436">Test Result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table44547282432" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row54541528184311"><th align="left" class="cellrowborder" valign="top" width="29.849999999999998%" id="mcps1.3.26.2.4.2.2.1.1.4.1.1"><p id="dli_08_15090__p745452810438">result</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="20.96%" id="mcps1.3.26.2.4.2.2.1.1.4.1.2"><p id="dli_08_15090__p9454142820432">result2</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="49.19%" id="mcps1.3.26.2.4.2.2.1.1.4.1.3"><p id="dli_08_15090__p85611581625">result3</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row545432811435"><td class="cellrowborder" valign="top" width="29.849999999999998%" headers="mcps1.3.26.2.4.2.2.1.1.4.1.1 "><p id="dli_08_15090__p11454152874313">13:15</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.96%" headers="mcps1.3.26.2.4.2.2.1.1.4.1.2 "><p id="dli_08_15090__p1845492844315">13:15</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="49.19%" headers="mcps1.3.26.2.4.2.2.1.1.4.1.3 "><p id="dli_08_15090__p3561185818216">1997-04-25T13:15</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section132721624154711"><a name="dli_08_15090__section132721624154711"></a><a name="section132721624154711"></a><h4 class="sectiontitle">OVERLAPS</h4><ul id="dli_08_15090__ul19272162412472"><li id="dli_08_15090__li1272152414471"><strong id="dli_08_15090__b32721424204711">Function</strong><p id="dli_08_15090__p185715194817">Returns <strong id="dli_08_15090__b2986278444495">TRUE</strong> if two time intervals overlap; returns <strong id="dli_08_15090__b8761051724495">FALSE</strong> otherwise.</p>
|
|
</li><li id="dli_08_15090__li627220245477"><strong id="dli_08_15090__b1272224114712">Description</strong><pre class="screen" id="dli_08_15090__screen1272824134713">BOOLEAN (timepoint1, temporal1) <strong id="dli_08_15090__b1491953917612">OVERLAPS </strong>(timepoint2, temporal2)</pre>
|
|
</li><li id="dli_08_15090__li14272124154716"><strong id="dli_08_15090__b62721524184718">Input parameters</strong>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table5272112419472" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row14272142424716"><th align="left" class="cellrowborder" valign="top" width="22.132213221322132%" id="mcps1.3.27.2.3.2.1.4.1.1"><p id="dli_08_15090__p2272152434720">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="23.472347234723472%" id="mcps1.3.27.2.3.2.1.4.1.2"><p id="dli_08_15090__p1427322410479">Data Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="54.3954395439544%" id="mcps1.3.27.2.3.2.1.4.1.3"><p id="dli_08_15090__p1127319247479">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row1727382415473"><td class="cellrowborder" valign="top" width="22.132213221322132%" headers="mcps1.3.27.2.3.2.1.4.1.1 "><p id="dli_08_15090__p25272524542">timepoint1/timepoint2</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="23.472347234723472%" headers="mcps1.3.27.2.3.2.1.4.1.2 "><p id="dli_08_15090__p10273112416478">DATE/TIME/TIMESTAMP</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="54.3954395439544%" headers="mcps1.3.27.2.3.2.1.4.1.3 "><p id="dli_08_15090__p927317240472">Time point</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row027372414713"><td class="cellrowborder" valign="top" width="22.132213221322132%" headers="mcps1.3.27.2.3.2.1.4.1.1 "><p id="dli_08_15090__p198811359555">temporal1/temporal2</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="23.472347234723472%" headers="mcps1.3.27.2.3.2.1.4.1.2 "><p id="dli_08_15090__p1327372415473">DATE/TIME/TIMESTAMP/INTERVAL</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="54.3954395439544%" headers="mcps1.3.27.2.3.2.1.4.1.3 "><p id="dli_08_15090__p8273142418470">Time point or interval</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="note" id="dli_08_15090__note762811581144"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="dli_08_15090__ul78071732353"><li id="dli_08_15090__li511113614514"><strong id="dli_08_15090__b11765176684495">(timepoint, temporal)</strong> is a closed interval.</li><li id="dli_08_15090__li780717327511">The temporal can be of the <strong id="dli_08_15090__b2840907834495">DATE</strong>, <strong id="dli_08_15090__b8761735514495">TIME</strong>, <strong id="dli_08_15090__b11285655374495">TIMESTAMP</strong>, or <strong id="dli_08_15090__b9248710764495">INTERVAL</strong> type.<ul id="dli_08_15090__ul96231054175211"><li id="dli_08_15090__li6623185411527">When th temporal is <strong id="dli_08_15090__b6510986484495">DATE</strong>, <strong id="dli_08_15090__b11291510194495">TIME</strong>, or <strong id="dli_08_15090__b7803068234495">TIMESTAMP</strong>, <strong id="dli_08_15090__b20350482844495">(timepoint, temporal)</strong> indicates an interval between <strong id="dli_08_15090__b6796995434495">timepoint</strong> and <strong id="dli_08_15090__b36616464495">temporal</strong>. The temporal can be earlier than the value of <strong id="dli_08_15090__b17776364714495">timepoint</strong>, for example, <strong id="dli_08_15090__b11919734854495">(DATE '1997-04-25', DATE '1997-04-23')</strong>.</li><li id="dli_08_15090__li926405895213">When the temporal is <strong id="dli_08_15090__b1059615964495">INTERVAL</strong>, <strong id="dli_08_15090__b179946664495">(timepoint, temporal)</strong> indicates an interval between <strong id="dli_08_15090__b6325050004495">timepoint</strong> and <strong id="dli_08_15090__b18207708764495">timepoint + temporal</strong>.</li></ul>
|
|
</li><li id="dli_08_15090__li15129184012514">Ensure that <strong id="dli_08_15090__b5466964024495">(timepoint1, temporal1)</strong> and <strong id="dli_08_15090__b21334451784495">(timepoint2, temporal2)</strong> are intervals of the same data type.</li></ul>
|
|
</div></div>
|
|
</li><li id="dli_08_15090__li727352484711"><strong id="dli_08_15090__b627382464711">Example</strong><ul id="dli_08_15090__ul227302414475"><li id="dli_08_15090__li17273624174717">Test statement<pre class="screen" id="dli_08_15090__screen112733241470">SELECT
|
|
(TIME '2:55:00', INTERVAL '1' HOUR) OVERLAPS (TIME '3:30:00', INTERVAL '2' HOUR) AS `result`,
|
|
(TIME '2:30:00', INTERVAL '1' HOUR) OVERLAPS (TIME '3:30:00', INTERVAL '2' HOUR) AS `result2`,
|
|
(TIME '2:30:00', INTERVAL '1' HOUR) OVERLAPS (TIME '3:31:00', INTERVAL '2' HOUR) AS `result3`,
|
|
(TIME '9:00:00', TIME '10:00:00') OVERLAPS (TIME '10:00:00', INTERVAL '3' HOUR) AS `result4`,
|
|
(TIMESTAMP '1997-04-25 12:00:00', TIMESTAMP '1997-04-25 12:20:00') OVERLAPS (TIMESTAMP '1997-04-25 13:00:00', INTERVAL '2' HOUR) AS `result5`,
|
|
(DATE '1997-04-23', INTERVAL '2' DAY) OVERLAPS (DATE '1997-04-25', INTERVAL '2' DAY) AS `result6`,
|
|
(DATE '1997-04-25', DATE '1997-04-23') OVERLAPS (DATE '1997-04-25', INTERVAL '2' DAY) AS `result7`
|
|
FROM
|
|
testtable;</pre>
|
|
</li><li id="dli_08_15090__li1827310242474">Test Result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table152731424124711" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row4274124184715"><th align="left" class="cellrowborder" valign="top" width="7.5%" id="mcps1.3.27.2.4.2.2.1.1.8.1.1"><p id="dli_08_15090__p1427414243474">result</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="7.3999999999999995%" id="mcps1.3.27.2.4.2.2.1.1.8.1.2"><p id="dli_08_15090__p627462424717">result2</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="8.19%" id="mcps1.3.27.2.4.2.2.1.1.8.1.3"><p id="dli_08_15090__p1068715231210">result3</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="8.290000000000001%" id="mcps1.3.27.2.4.2.2.1.1.8.1.4"><p id="dli_08_15090__p1134282720110">result4</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="9.049999999999999%" id="mcps1.3.27.2.4.2.2.1.1.8.1.5"><p id="dli_08_15090__p1943393714110">result5</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="9.46%" id="mcps1.3.27.2.4.2.2.1.1.8.1.6"><p id="dli_08_15090__p1214104013113">result6</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="50.11%" id="mcps1.3.27.2.4.2.2.1.1.8.1.7"><p id="dli_08_15090__p1863120421918">result7</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row927420242470"><td class="cellrowborder" valign="top" width="7.5%" headers="mcps1.3.27.2.4.2.2.1.1.8.1.1 "><p id="dli_08_15090__p12741724144712">true</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="7.3999999999999995%" headers="mcps1.3.27.2.4.2.2.1.1.8.1.2 "><p id="dli_08_15090__p13274162413474">true</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="8.19%" headers="mcps1.3.27.2.4.2.2.1.1.8.1.3 "><p id="dli_08_15090__p18687123410">false</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="8.290000000000001%" headers="mcps1.3.27.2.4.2.2.1.1.8.1.4 "><p id="dli_08_15090__p1534312716110">true</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="9.049999999999999%" headers="mcps1.3.27.2.4.2.2.1.1.8.1.5 "><p id="dli_08_15090__p0433237412">false</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="9.46%" headers="mcps1.3.27.2.4.2.2.1.1.8.1.6 "><p id="dli_08_15090__p01413406117">true</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50.11%" headers="mcps1.3.27.2.4.2.2.1.1.8.1.7 "><p id="dli_08_15090__p10631842315">true</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section98557160415"><a name="dli_08_15090__section98557160415"></a><a name="section98557160415"></a><h4 class="sectiontitle">DATE_FORMAT</h4><ul id="dli_08_15090__ul185516162041"><li id="dli_08_15090__li19855181615414"><strong id="dli_08_15090__b38556169418">Function</strong><p id="dli_08_15090__p57420541348">Converts a timestamp to a value of string in the format specified by the date format string.</p>
|
|
</li><li id="dli_08_15090__li885714161249"><strong id="dli_08_15090__b785714161943">Description</strong><pre class="screen" id="dli_08_15090__screen168571166410">STRING <strong id="dli_08_15090__b8832236397">DATE_FORMAT</strong>(timestamp, dateformat)</pre>
|
|
</li><li id="dli_08_15090__li385813162046"><strong id="dli_08_15090__b138600167410">Input parameters</strong>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table586151617413" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row686320167414"><th align="left" class="cellrowborder" valign="top" width="22.132213221322132%" id="mcps1.3.28.2.3.2.1.4.1.1"><p id="dli_08_15090__p1686319169417">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="20.142014201420142%" id="mcps1.3.28.2.3.2.1.4.1.2"><p id="dli_08_15090__p18863616347">Data Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="57.72577257725773%" id="mcps1.3.28.2.3.2.1.4.1.3"><p id="dli_08_15090__p8864316742">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row986411614411"><td class="cellrowborder" valign="top" width="22.132213221322132%" headers="mcps1.3.28.2.3.2.1.4.1.1 "><p id="dli_08_15090__p1986410161546">timestamp</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.142014201420142%" headers="mcps1.3.28.2.3.2.1.4.1.2 "><p id="dli_08_15090__p58651116346">TIMESTAMP/STRING</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.72577257725773%" headers="mcps1.3.28.2.3.2.1.4.1.3 "><p id="dli_08_15090__p386516167410">Time point</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row1186513161041"><td class="cellrowborder" valign="top" width="22.132213221322132%" headers="mcps1.3.28.2.3.2.1.4.1.1 "><p id="dli_08_15090__p14866101614410">dateformat</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.142014201420142%" headers="mcps1.3.28.2.3.2.1.4.1.2 "><p id="dli_08_15090__p9866161618417">STRING</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.72577257725773%" headers="mcps1.3.28.2.3.2.1.4.1.3 "><p id="dli_08_15090__p78660160411">String in the date format</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="dli_08_15090__li0866616246"><strong id="dli_08_15090__b18675161742">Example</strong><ul id="dli_08_15090__ul10867131615419"><li id="dli_08_15090__li138679165416">Test statement<pre class="screen" id="dli_08_15090__screen148671816545">SELECT
|
|
DATE_FORMAT(TIMESTAMP '1997-04-25 10:11:12', 'yyyy-MM-dd HH:mm:ss') AS `result`,
|
|
DATE_FORMAT(TIMESTAMP '1997-04-25 10:11:12', 'yyyy-MM-dd') AS `result2`,
|
|
DATE_FORMAT(TIMESTAMP '1997-04-25 10:11:12', 'yy/MM/dd HH:mm') AS `result3`,
|
|
DATE_FORMAT('1997-04-25 10:11:12', 'yyyy-MM-dd') AS `result4`
|
|
FROM testtable;</pre>
|
|
</li><li id="dli_08_15090__li15868171613419">Test Result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table15869016241" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row687081620410"><th align="left" class="cellrowborder" valign="top" width="25.650000000000002%" id="mcps1.3.28.2.4.2.2.1.1.5.1.1"><p id="dli_08_15090__p14870101613414">result</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="21.44%" id="mcps1.3.28.2.4.2.2.1.1.5.1.2"><p id="dli_08_15090__p128701816945">result2</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="20.47%" id="mcps1.3.28.2.4.2.2.1.1.5.1.3"><p id="dli_08_15090__p11871131616412">result3</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="32.440000000000005%" id="mcps1.3.28.2.4.2.2.1.1.5.1.4"><p id="dli_08_15090__p17871416947">result4</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row1687218161419"><td class="cellrowborder" valign="top" width="25.650000000000002%" headers="mcps1.3.28.2.4.2.2.1.1.5.1.1 "><p id="dli_08_15090__p14872516146">1997-04-25 10:11:12</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="21.44%" headers="mcps1.3.28.2.4.2.2.1.1.5.1.2 "><p id="dli_08_15090__p108724161241">1997-04-25</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.47%" headers="mcps1.3.28.2.4.2.2.1.1.5.1.3 "><p id="dli_08_15090__p3873116546">97/04/25 10:11</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="32.440000000000005%" headers="mcps1.3.28.2.4.2.2.1.1.5.1.4 "><p id="dli_08_15090__p188734162417">1997-04-25</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section105601517203220"><a name="dli_08_15090__section105601517203220"></a><a name="section105601517203220"></a><h4 class="sectiontitle">TIMESTAMPADD</h4><ul id="dli_08_15090__ul19561417193211"><li id="dli_08_15090__li165611417183217"><strong id="dli_08_15090__b13561131733216">Function</strong><p id="dli_08_15090__p6332144511618">Returns the date and time by combining <strong id="dli_08_15090__b2631026584495">interval</strong> and <strong id="dli_08_15090__b17494746314495">timeintervalunit</strong> and adding the combination to <strong id="dli_08_15090__b19576640204495">timepoint</strong>.</p>
|
|
<div class="note" id="dli_08_15090__note16429629101812"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="dli_08_15090__p12546131901919">The return value of <strong id="dli_08_15090__b18134077574495">TIMESTAMPADD</strong> is the value of <strong id="dli_08_15090__b1752060464495">timepoint</strong>. An exception is that if the input <strong id="dli_08_15090__b7548809564495">timepoint</strong> is of the <strong id="dli_08_15090__b18355944464495">TIMESTAMP</strong> type, the return value can be inserted into a table field of the <strong id="dli_08_15090__b3235825374495">DATE</strong> type.</p>
|
|
</div></div>
|
|
</li><li id="dli_08_15090__li456181763213"><strong id="dli_08_15090__b856117170322">Description</strong><pre class="screen" id="dli_08_15090__screen1856181711320">TIMESTAMP(3)/DATE/TIME <strong id="dli_08_15090__b44289614160">TIMESTAMPADD</strong>(timeintervalunit, interval, timepoint)</pre>
|
|
</li><li id="dli_08_15090__li185615174324"><strong id="dli_08_15090__b15561191718324">Input parameters</strong>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table20561181723219" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row19561101711322"><th align="left" class="cellrowborder" valign="top" width="22.132213221322132%" id="mcps1.3.29.2.3.2.1.4.1.1"><p id="dli_08_15090__p135611217193212">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="20.142014201420142%" id="mcps1.3.29.2.3.2.1.4.1.2"><p id="dli_08_15090__p1556181793219">Data Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="57.72577257725773%" id="mcps1.3.29.2.3.2.1.4.1.3"><p id="dli_08_15090__p056171720328">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row16561917193216"><td class="cellrowborder" valign="top" width="22.132213221322132%" headers="mcps1.3.29.2.3.2.1.4.1.1 "><p id="dli_08_15090__p2056114175321">timeintervalunit</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.142014201420142%" headers="mcps1.3.29.2.3.2.1.4.1.2 "><p id="dli_08_15090__p1856113173321">TIMEUNIT</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.72577257725773%" headers="mcps1.3.29.2.3.2.1.4.1.3 "><p id="dli_08_15090__p1456211175328">Time unit.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row356231753214"><td class="cellrowborder" valign="top" width="22.132213221322132%" headers="mcps1.3.29.2.3.2.1.4.1.1 "><p id="dli_08_15090__p25621217103210">interval</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.142014201420142%" headers="mcps1.3.29.2.3.2.1.4.1.2 "><p id="dli_08_15090__p125623175324">INT</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.72577257725773%" headers="mcps1.3.29.2.3.2.1.4.1.3 "><p id="dli_08_15090__p65621917153211">Interval</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row194001519123517"><td class="cellrowborder" valign="top" width="22.132213221322132%" headers="mcps1.3.29.2.3.2.1.4.1.1 "><p id="dli_08_15090__p2401181903511">timepoint</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.142014201420142%" headers="mcps1.3.29.2.3.2.1.4.1.2 "><p id="dli_08_15090__p11401019183520">TIMESTAMP/DATE/TIME</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.72577257725773%" headers="mcps1.3.29.2.3.2.1.4.1.3 "><p id="dli_08_15090__p164018198356">Time point</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="dli_08_15090__li1756241715323"><strong id="dli_08_15090__b756281716327">Example</strong><ul id="dli_08_15090__ul9562141716326"><li id="dli_08_15090__li756201783211">Test statement<pre class="screen" id="dli_08_15090__screen6562191783215">SELECT
|
|
TIMESTAMPADD(WEEK, 1, DATE '1997-04-25') AS `result`,
|
|
TIMESTAMPADD(QUARTER, 1, TIMESTAMP '1997-04-25 10:11:12') AS `result2`,
|
|
TIMESTAMPADD(SECOND, 2, TIME '10:11:12') AS `result3`
|
|
FROM testtable;</pre>
|
|
</li><li id="dli_08_15090__li195621817163211">Test Result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table14562171713215" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row105622177327"><th align="left" class="cellrowborder" valign="top" width="37.97%" id="mcps1.3.29.2.4.2.2.1.1.4.1.1"><p id="dli_08_15090__p6562111716322">result</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="35.03%" id="mcps1.3.29.2.4.2.2.1.1.4.1.2"><p id="dli_08_15090__p12562817173216">result2</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="27%" id="mcps1.3.29.2.4.2.2.1.1.4.1.3"><p id="dli_08_15090__p105633178320">result3</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row185631176321"><td class="cellrowborder" valign="top" width="37.97%" headers="mcps1.3.29.2.4.2.2.1.1.4.1.1 "><p id="dli_08_15090__p11563121733216">1997-05-02</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="35.03%" headers="mcps1.3.29.2.4.2.2.1.1.4.1.2 "><ul id="dli_08_15090__ul55011211182515"><li id="dli_08_15090__li1250114116251">If this field is inserted into a table field of the <strong id="dli_08_15090__b9052214344495">TIMESTAMP</strong> type, <strong id="dli_08_15090__b6814731914495">1997-07-25T10:11:12</strong> is returned.</li></ul>
|
|
<ul id="dli_08_15090__ul14169152116252"><li id="dli_08_15090__li41697212251">If this field is inserted into a table field of the TIMESTAMP type, 1997-07-25 is returned.</li></ul>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="27%" headers="mcps1.3.29.2.4.2.2.1.1.4.1.3 "><p id="dli_08_15090__p956351793215">10:11:14</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section16290114810404"><a name="dli_08_15090__section16290114810404"></a><a name="section16290114810404"></a><h4 class="sectiontitle">TIMESTAMPDIFF</h4><ul id="dli_08_15090__ul1729084813409"><li id="dli_08_15090__li2029074854013"><strong id="dli_08_15090__b122911748194013">Function</strong><p id="dli_08_15090__p10292141522610">Returns the (signed) number of <strong id="dli_08_15090__b19164915244495">timepointunit</strong> between <strong id="dli_08_15090__b17631402314495">timepoint1</strong> and <strong id="dli_08_15090__b16565937464495">timepoint2</strong>. The unit for the interval is given by the first argument.</p>
|
|
</li><li id="dli_08_15090__li1829115485409"><strong id="dli_08_15090__b1429114483409">Description</strong><pre class="screen" id="dli_08_15090__screen20291174810408">INT <strong id="dli_08_15090__b12975163612917">TIMESTAMPDIFF</strong>(timepointunit, timepoint1, timepoint2)</pre>
|
|
</li><li id="dli_08_15090__li5291124820404"><strong id="dli_08_15090__b1429124811404">Input parameters</strong>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table529164817400" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row1529174810401"><th align="left" class="cellrowborder" valign="top" width="22.65226522652265%" id="mcps1.3.30.2.3.2.1.4.1.1"><p id="dli_08_15090__p15291134815404">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="19.611961196119612%" id="mcps1.3.30.2.3.2.1.4.1.2"><p id="dli_08_15090__p6291194815400">Data Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="57.73577357735774%" id="mcps1.3.30.2.3.2.1.4.1.3"><p id="dli_08_15090__p829154811407">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row19291194818401"><td class="cellrowborder" valign="top" width="22.65226522652265%" headers="mcps1.3.30.2.3.2.1.4.1.1 "><p id="dli_08_15090__p5291348134018">timepointunit</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="19.611961196119612%" headers="mcps1.3.30.2.3.2.1.4.1.2 "><p id="dli_08_15090__p11291154813401">TIMEUNIT</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.73577357735774%" headers="mcps1.3.30.2.3.2.1.4.1.3 "><p id="dli_08_15090__p6291104814404">Time unit. The value can be <strong id="dli_08_15090__b1737734514495">SECOND</strong>, <strong id="dli_08_15090__b11827348304495">MINUTE</strong>, <strong id="dli_08_15090__b18463161884495">HOUR</strong>, <strong id="dli_08_15090__b18422197734495">DAY</strong>, <strong id="dli_08_15090__b9955578934495">MONTH </strong>or <strong id="dli_08_15090__b981639444495">YEAR</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row929224815401"><td class="cellrowborder" valign="top" width="22.65226522652265%" headers="mcps1.3.30.2.3.2.1.4.1.1 "><p id="dli_08_15090__p5794479264">timepoint1/timepoint2</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="19.611961196119612%" headers="mcps1.3.30.2.3.2.1.4.1.2 "><p id="dli_08_15090__p1729204811408">TIMESTAMP/DATE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.73577357735774%" headers="mcps1.3.30.2.3.2.1.4.1.3 "><p id="dli_08_15090__p1429215480403">Time point</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="dli_08_15090__li13292154818407"><strong id="dli_08_15090__b16292164816409">Example</strong><ul id="dli_08_15090__ul7292104813406"><li id="dli_08_15090__li929214486409">Test statement<pre class="screen" id="dli_08_15090__screen1292114844018">SELECT
|
|
TIMESTAMPDIFF(DAY, TIMESTAMP '1997-04-25 10:00:00', TIMESTAMP '1997-04-28 10:00:00') AS `result`,
|
|
TIMESTAMPDIFF(DAY, DATE '1997-04-25', DATE '1997-04-28') AS `result2`,
|
|
TIMESTAMPDIFF(DAY, TIMESTAMP '1997-04-27 10:00:20', TIMESTAMP '1997-04-25 10:00:00') AS `result3`
|
|
FROM testtable;</pre>
|
|
</li><li id="dli_08_15090__li1029218488406">Test result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table14292748144018" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row1629213482407"><th align="left" class="cellrowborder" valign="top" width="37.97%" id="mcps1.3.30.2.4.2.2.1.1.4.1.1"><p id="dli_08_15090__p102925482406">result</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="31.730000000000004%" id="mcps1.3.30.2.4.2.2.1.1.4.1.2"><p id="dli_08_15090__p629364817405">result2</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="30.3%" id="mcps1.3.30.2.4.2.2.1.1.4.1.3"><p id="dli_08_15090__p429304818408">result3</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row129316483401"><td class="cellrowborder" valign="top" width="37.97%" headers="mcps1.3.30.2.4.2.2.1.1.4.1.1 "><p id="dli_08_15090__p9293104820400">3</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="31.730000000000004%" headers="mcps1.3.30.2.4.2.2.1.1.4.1.2 "><p id="dli_08_15090__p11293174812407">3</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="30.3%" headers="mcps1.3.30.2.4.2.2.1.1.4.1.3 "><p id="dli_08_15090__p192931348144010">-2</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section1698193003115"><a name="dli_08_15090__section1698193003115"></a><a name="section1698193003115"></a><h4 class="sectiontitle">CONVERT_TZ</h4><ul id="dli_08_15090__ul1569923013314"><li id="dli_08_15090__li11699123013113"><strong id="dli_08_15090__b96991630183110">Function</strong><p id="dli_08_15090__p7699103017311">Converts a datetime<strong id="dli_08_15090__b16826032104495"> string1</strong> (with default ISO timestamp format <strong id="dli_08_15090__b14305350814495">'yyyy-MM-dd HH:mm:ss'</strong>) from time zone <strong id="dli_08_15090__b6092046424495">string2</strong> to time zone <strong id="dli_08_15090__b17475893234495">string3</strong>.</p>
|
|
</li><li id="dli_08_15090__li126991130183112"><strong id="dli_08_15090__b76991730183113">Description</strong><pre class="screen" id="dli_08_15090__screen19699183063112">STRING <strong id="dli_08_15090__b14518182153116">CONVERT_TZ</strong>(string1, string2, string3)</pre>
|
|
</li><li id="dli_08_15090__li196997302317"><strong id="dli_08_15090__b969913308314">Input parameters</strong>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table106991730123112" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row18699830163119"><th align="left" class="cellrowborder" valign="top" width="22.132213221322132%" id="mcps1.3.31.2.3.2.1.4.1.1"><p id="dli_08_15090__p069993013115">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="20.13201320132013%" id="mcps1.3.31.2.3.2.1.4.1.2"><p id="dli_08_15090__p569920302317">Data Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="57.73577357735774%" id="mcps1.3.31.2.3.2.1.4.1.3"><p id="dli_08_15090__p106991330163115">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row15699103073116"><td class="cellrowborder" valign="top" width="22.132213221322132%" headers="mcps1.3.31.2.3.2.1.4.1.1 "><p id="dli_08_15090__p1969919301315">string1</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.13201320132013%" headers="mcps1.3.31.2.3.2.1.4.1.2 "><p id="dli_08_15090__p1670033016312">STRING</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.73577357735774%" headers="mcps1.3.31.2.3.2.1.4.1.3 "><p id="dli_08_15090__p1170033017311">SQL timestamp. If the value does not meet the format requirements, <strong id="dli_08_15090__b18853287634495">NULL</strong> is returned.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row1700133015313"><td class="cellrowborder" valign="top" width="22.132213221322132%" headers="mcps1.3.31.2.3.2.1.4.1.1 "><p id="dli_08_15090__p1670063013113">string2</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.13201320132013%" headers="mcps1.3.31.2.3.2.1.4.1.2 "><p id="dli_08_15090__p1070043013118">STRING</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.73577357735774%" headers="mcps1.3.31.2.3.2.1.4.1.3 "><p id="dli_08_15090__p17700193043114">Time zone before conversion. The format of time zone should be either an abbreviation such as <strong id="dli_08_15090__b29541450191214">PST</strong>, a full name such as <strong id="dli_08_15090__b159551150191213">Country A/City A</strong>, or a custom ID such as <strong id="dli_08_15090__b10955135016128">GMT-08:00</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row1993420401324"><td class="cellrowborder" valign="top" width="22.132213221322132%" headers="mcps1.3.31.2.3.2.1.4.1.1 "><p id="dli_08_15090__p19472154519327">string3</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.13201320132013%" headers="mcps1.3.31.2.3.2.1.4.1.2 "><p id="dli_08_15090__p14721045113212">STRING</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.73577357735774%" headers="mcps1.3.31.2.3.2.1.4.1.3 "><p id="dli_08_15090__p10472144514324">Time zone after conversion. The format of time zone should be either an abbreviation such as <strong id="dli_08_15090__b599625317128">PST</strong>, a full name such as <strong id="dli_08_15090__b1599635311217">Country A/City A</strong>, or a custom ID such as <strong id="dli_08_15090__b109961953171212">GMT-08:00</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="dli_08_15090__li8700113013114"><strong id="dli_08_15090__b370011303316">Example</strong><ul id="dli_08_15090__ul2700183093118"><li id="dli_08_15090__li1700113014315">Test statement<pre class="screen" id="dli_08_15090__screen15700163073118">SELECT
|
|
CONVERT_TZ(1970-01-01 00:00:00, UTC, Country A/City A) AS `result`,
|
|
CONVERT_TZ(1997-04-25 10:00:00, UTC, GMT-08:00) AS `result2`
|
|
FROM testtable;</pre>
|
|
</li><li id="dli_08_15090__li127001630173113">Test Result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table14700183015315" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row37001730163113"><th align="left" class="cellrowborder" valign="top" width="54.48%" id="mcps1.3.31.2.4.2.2.1.1.3.1.1"><p id="dli_08_15090__p1470017307318">result</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="45.519999999999996%" id="mcps1.3.31.2.4.2.2.1.1.3.1.2"><p id="dli_08_15090__p9701183043119">result2</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row77016307319"><td class="cellrowborder" valign="top" width="54.48%" headers="mcps1.3.31.2.4.2.2.1.1.3.1.1 "><p id="dli_08_15090__p16701163018316">1969-12-31 16:00:00</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="45.519999999999996%" headers="mcps1.3.31.2.4.2.2.1.1.3.1.2 "><p id="dli_08_15090__p1770111309310">1997-04-25 02:00:00</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section01032914372"><a name="dli_08_15090__section01032914372"></a><a name="section01032914372"></a><h4 class="sectiontitle">FROM_UNIXTIME</h4><ul id="dli_08_15090__ul1510311923717"><li id="dli_08_15090__li1210311916377"><strong id="dli_08_15090__b910339123715">Function</strong><p id="dli_08_15090__p111037913711">Returns a representation of the <strong id="dli_08_15090__b5138549274495">numeric</strong> argument as a value in string format.</p>
|
|
</li><li id="dli_08_15090__li910315920371"><strong id="dli_08_15090__b1910314933719">Description</strong><pre class="screen" id="dli_08_15090__screen1710318973714">STRING <strong id="dli_08_15090__b202669973418">FROM_UNIXTIME</strong>(numeric[, string])</pre>
|
|
</li><li id="dli_08_15090__li81038983710"><strong id="dli_08_15090__b11103139103710">Input parameters</strong>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table91031893377" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row910312933719"><th align="left" class="cellrowborder" valign="top" width="22.132213221322132%" id="mcps1.3.32.2.3.2.1.4.1.1"><p id="dli_08_15090__p18103189133716">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="20.13201320132013%" id="mcps1.3.32.2.3.2.1.4.1.2"><p id="dli_08_15090__p7103109183716">Data Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="57.73577357735774%" id="mcps1.3.32.2.3.2.1.4.1.3"><p id="dli_08_15090__p21041596374">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row1010416913371"><td class="cellrowborder" valign="top" width="22.132213221322132%" headers="mcps1.3.32.2.3.2.1.4.1.1 "><p id="dli_08_15090__p41046973717">numeric</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.13201320132013%" headers="mcps1.3.32.2.3.2.1.4.1.2 "><p id="dli_08_15090__p16104129143711">BIGINT</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.73577357735774%" headers="mcps1.3.32.2.3.2.1.4.1.3 "><p id="dli_08_15090__p1010416915372">An internal timestamp representing the number of seconds since 1970-01-01 00:00:00 UTC. The value can be generated by the <strong id="dli_08_15090__b12354912404495">UNIX_TIMESTAMP()</strong> function.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row810411916372"><td class="cellrowborder" valign="top" width="22.132213221322132%" headers="mcps1.3.32.2.3.2.1.4.1.1 "><p id="dli_08_15090__p61041492376">string</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.13201320132013%" headers="mcps1.3.32.2.3.2.1.4.1.2 "><p id="dli_08_15090__p1810489113711">STRING</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.73577357735774%" headers="mcps1.3.32.2.3.2.1.4.1.3 "><p id="dli_08_15090__p1910419183713">Time. If this parameter is not specified, the default time format is <strong id="dli_08_15090__b4044523654495">yyyy-MM-dd HH:mm:ss</strong> format.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="dli_08_15090__li61043923715"><strong id="dli_08_15090__b1104139103719">Example</strong><ul id="dli_08_15090__ul121045973717"><li id="dli_08_15090__li210439143714">Test statement<pre class="screen" id="dli_08_15090__screen1010589103716">SELECT
|
|
FROM_UNIXTIME(44) AS `result`,
|
|
FROM_UNIXTIME(44, 'yyyy:MM:dd') AS `result2`
|
|
FROM testtable;</pre>
|
|
</li><li id="dli_08_15090__li3105199153710">Test Result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table16105496379" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row510569173718"><th align="left" class="cellrowborder" valign="top" width="54.48%" id="mcps1.3.32.2.4.2.2.1.1.3.1.1"><p id="dli_08_15090__p1910510943711">result</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="45.519999999999996%" id="mcps1.3.32.2.4.2.2.1.1.3.1.2"><p id="dli_08_15090__p1610514953719">result2</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row01055916373"><td class="cellrowborder" valign="top" width="54.48%" headers="mcps1.3.32.2.4.2.2.1.1.3.1.1 "><p id="dli_08_15090__p510579183710">1970-01-01 08:00:44</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="45.519999999999996%" headers="mcps1.3.32.2.4.2.2.1.1.3.1.2 "><p id="dli_08_15090__p171051399378">1970:01:01</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section166571146145016"><a name="dli_08_15090__section166571146145016"></a><a name="section166571146145016"></a><h4 class="sectiontitle">UNIX_TIMESTAMP</h4><ul id="dli_08_15090__ul1565814665017"><li id="dli_08_15090__li19658846195016"><strong id="dli_08_15090__b146581346125012">Function</strong><p id="dli_08_15090__p1165813468507">Gets current Unix timestamp in seconds. The return value is of the <strong id="dli_08_15090__b8531927684495">BIGINT</strong> type.</p>
|
|
</li><li id="dli_08_15090__li265810461501"><strong id="dli_08_15090__b9658546125012">Description</strong><pre class="screen" id="dli_08_15090__screen1658164645020">BIGINT <strong id="dli_08_15090__b14595191254011">UNIX_TIMESTAMP</strong>()</pre>
|
|
</li><li id="dli_08_15090__li965864615503"><strong id="dli_08_15090__b56581446185013">Input parameters</strong><p id="dli_08_15090__p481774245115">None</p>
|
|
</li><li id="dli_08_15090__li1765904625012"><strong id="dli_08_15090__b1965924611507">Example</strong><ul id="dli_08_15090__ul13659164614509"><li id="dli_08_15090__li106591746185012">Test statement<pre class="screen" id="dli_08_15090__screen1665964615509">SELECT
|
|
UNIX_TIMESTAMP() AS `result`
|
|
FROM
|
|
table;</pre>
|
|
</li><li id="dli_08_15090__li1565974611508">Test result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table17659134614502" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row1765964614509"><th align="left" class="cellrowborder" valign="top" width="100%" id="mcps1.3.33.2.4.2.2.1.1.2.1.1"><p id="dli_08_15090__p1166074695013">result</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row17660154605016"><td class="cellrowborder" valign="top" width="100%" headers="mcps1.3.33.2.4.2.2.1.1.2.1.1 "><p id="dli_08_15090__p1366010461502">1635401982</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section175599271533"><a name="dli_08_15090__section175599271533"></a><a name="section175599271533"></a><h4 class="sectiontitle">UNIX_TIMESTAMP(string1[, string2])</h4><ul id="dli_08_15090__ul1955915279316"><li id="dli_08_15090__li195591227936"><strong id="dli_08_15090__b1555915277314">Function</strong><p id="dli_08_15090__p1955912720316">Converts date time <strong id="dli_08_15090__b13931170594495">string1</strong> in format <strong id="dli_08_15090__b21044409934495">string2</strong> to Unix timestamp (in seconds). The return value is of the <strong id="dli_08_15090__b15862237534495">BIGINT</strong> type.</p>
|
|
</li><li id="dli_08_15090__li555942710316"><strong id="dli_08_15090__b165594272318">Description</strong><pre class="screen" id="dli_08_15090__screen1356019271239">BIGINT <strong id="dli_08_15090__b10746144164110">UNIX_TIMESTAMP</strong>(string1[, string2])</pre>
|
|
</li><li id="dli_08_15090__li1656020272313"><strong id="dli_08_15090__b2056018272034">Input parameters</strong>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table1697682813211" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row7976182803216"><th align="left" class="cellrowborder" valign="top" width="22.132213221322132%" id="mcps1.3.34.2.3.2.1.4.1.1"><p id="dli_08_15090__p18976328193215">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="20.13201320132013%" id="mcps1.3.34.2.3.2.1.4.1.2"><p id="dli_08_15090__p097619288322">Data Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="57.73577357735774%" id="mcps1.3.34.2.3.2.1.4.1.3"><p id="dli_08_15090__p12976428163216">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row179761228133212"><td class="cellrowborder" valign="top" width="22.132213221322132%" headers="mcps1.3.34.2.3.2.1.4.1.1 "><p id="dli_08_15090__p17472113883212">string1</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.13201320132013%" headers="mcps1.3.34.2.3.2.1.4.1.2 "><p id="dli_08_15090__p69761128183214">STRING</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.73577357735774%" headers="mcps1.3.34.2.3.2.1.4.1.3 "><p id="dli_08_15090__p169764281324">SQL timestamp string. An error is reported if the value does not comply with the <strong id="dli_08_15090__b15016256284495">string2</strong> format.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row5976628153212"><td class="cellrowborder" valign="top" width="22.132213221322132%" headers="mcps1.3.34.2.3.2.1.4.1.1 "><p id="dli_08_15090__p2061217430321">string2</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.13201320132013%" headers="mcps1.3.34.2.3.2.1.4.1.2 "><p id="dli_08_15090__p13976192815321">STRING</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.73577357735774%" headers="mcps1.3.34.2.3.2.1.4.1.3 "><p id="dli_08_15090__p13977172873220">Time. If this parameter is not specified, the default time format is <strong id="dli_08_15090__b18019713974495">yyyy-MM-dd HH:mm:ss</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="dli_08_15090__li1556015275318"><strong id="dli_08_15090__b45601271738">Example</strong><ul id="dli_08_15090__ul1156017270317"><li id="dli_08_15090__li125603271037">Test statement<pre class="screen" id="dli_08_15090__screen856017271635">SELECT
|
|
UNIX_TIMESTAMP('1997-04-25', 'yyyy-MM-dd') AS `result`,
|
|
UNIX_TIMESTAMP('1997-04-25 00:00:10', 'yyyy-MM-dd HH:mm:ss') AS `result2`,
|
|
UNIX_TIMESTAMP('1997-04-25 00:00:00') AS `result3`
|
|
FROM
|
|
testtable;</pre>
|
|
</li><li id="dli_08_15090__li256011271430">Test result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table10560627636" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row556016271319"><th align="left" class="cellrowborder" valign="top" width="18.459999999999997%" id="mcps1.3.34.2.4.2.2.1.1.4.1.1"><p id="dli_08_15090__p55604271833">result</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="16.97%" id="mcps1.3.34.2.4.2.2.1.1.4.1.2"><p id="dli_08_15090__p17246100113515">result2</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="64.57000000000001%" id="mcps1.3.34.2.4.2.2.1.1.4.1.3"><p id="dli_08_15090__p59761811354">result3</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row115600271530"><td class="cellrowborder" valign="top" width="18.459999999999997%" headers="mcps1.3.34.2.4.2.2.1.1.4.1.1 "><p id="dli_08_15090__p105615276311">861897600</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.97%" headers="mcps1.3.34.2.4.2.2.1.1.4.1.2 "><p id="dli_08_15090__p72466043518">861897610</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="64.57000000000001%" headers="mcps1.3.34.2.4.2.2.1.1.4.1.3 "><p id="dli_08_15090__p997618813514">861897600</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section1871816161526"><a name="dli_08_15090__section1871816161526"></a><a name="section1871816161526"></a><h4 class="sectiontitle">TO_DATE</h4><ul id="dli_08_15090__ul97184166529"><li id="dli_08_15090__li9718016165211"><strong id="dli_08_15090__b1271831645214">Function</strong><p id="dli_08_15090__p1871812161524">Converts a date <strong id="dli_08_15090__b19314930864495">string1</strong> with format <strong id="dli_08_15090__b3664285244495">string2</strong> to a date.</p>
|
|
</li><li id="dli_08_15090__li471811617525"><strong id="dli_08_15090__b1871817161525">Description</strong><pre class="screen" id="dli_08_15090__screen187181316135217">DATE <strong id="dli_08_15090__b382512684516">TO_DATE</strong>(string1[, string2])</pre>
|
|
</li><li id="dli_08_15090__li10718916155219"><strong id="dli_08_15090__b7718816135212">Input parameters</strong>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table1171813164529" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row171813163520"><th align="left" class="cellrowborder" valign="top" width="22.132213221322132%" id="mcps1.3.35.2.3.2.1.4.1.1"><p id="dli_08_15090__p10718316185215">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="20.13201320132013%" id="mcps1.3.35.2.3.2.1.4.1.2"><p id="dli_08_15090__p1371819160522">Data Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="57.73577357735774%" id="mcps1.3.35.2.3.2.1.4.1.3"><p id="dli_08_15090__p6719101618526">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row27194160527"><td class="cellrowborder" valign="top" width="22.132213221322132%" headers="mcps1.3.35.2.3.2.1.4.1.1 "><p id="dli_08_15090__p3719161635214">string1</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.13201320132013%" headers="mcps1.3.35.2.3.2.1.4.1.2 "><p id="dli_08_15090__p9719116105216">STRING</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.73577357735774%" headers="mcps1.3.35.2.3.2.1.4.1.3 "><p id="dli_08_15090__p3719121605214">SQL timestamp string. If the value is not in the required format, an error is reported.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row371917169526"><td class="cellrowborder" valign="top" width="22.132213221322132%" headers="mcps1.3.35.2.3.2.1.4.1.1 "><p id="dli_08_15090__p9719111611526">string2</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.13201320132013%" headers="mcps1.3.35.2.3.2.1.4.1.2 "><p id="dli_08_15090__p12719191625213">STRING</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.73577357735774%" headers="mcps1.3.35.2.3.2.1.4.1.3 "><p id="dli_08_15090__p2719816135218">Format. If this parameter is not specified, the default time format is <strong id="dli_08_15090__b6648715524495">yyyy-MM-dd</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="dli_08_15090__li571913166524"><strong id="dli_08_15090__b871915167528">Example</strong><ul id="dli_08_15090__ul8719516195219"><li id="dli_08_15090__li071917163528">Test statement<pre class="screen" id="dli_08_15090__screen371901617529">SELECT
|
|
TO_DATE('1997-04-25') AS `result`,
|
|
TO_DATE('1997:04:25', 'yyyy-MM-dd') AS `result2`,
|
|
TO_DATE('1997-04-25 00:00:00', 'yyyy-MM-dd HH:mm:ss') AS `result3`
|
|
FROM
|
|
testtable;</pre>
|
|
</li><li id="dli_08_15090__li167204169524">Test result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table3720116195214" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row1172081611529"><th align="left" class="cellrowborder" valign="top" width="18.459999999999997%" id="mcps1.3.35.2.4.2.2.1.1.4.1.1"><p id="dli_08_15090__p272091635220">result</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="16.97%" id="mcps1.3.35.2.4.2.2.1.1.4.1.2"><p id="dli_08_15090__p1972051611528">result2</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="64.57000000000001%" id="mcps1.3.35.2.4.2.2.1.1.4.1.3"><p id="dli_08_15090__p472061615217">result3</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row11720416185211"><td class="cellrowborder" valign="top" width="18.459999999999997%" headers="mcps1.3.35.2.4.2.2.1.1.4.1.1 "><p id="dli_08_15090__p14720216185213">1997-04-25</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.97%" headers="mcps1.3.35.2.4.2.2.1.1.4.1.2 "><p id="dli_08_15090__p772051614526">1997-04-25</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="64.57000000000001%" headers="mcps1.3.35.2.4.2.2.1.1.4.1.3 "><p id="dli_08_15090__p872071616527">1997-04-25</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_15090__section1374114020551"><a name="dli_08_15090__section1374114020551"></a><a name="section1374114020551"></a><h4 class="sectiontitle">TO_TIMESTAMP</h4><ul id="dli_08_15090__ul637410405551"><li id="dli_08_15090__li12374114014558"><strong id="dli_08_15090__b16374340105513">Function</strong><p id="dli_08_15090__p18313720144911">Converts date time <strong id="dli_08_15090__b15929791574495">string1</strong> with format <strong id="dli_08_15090__b17363039664495">string2</strong> to a timestamp.</p>
|
|
</li><li id="dli_08_15090__li20374740155520"><strong id="dli_08_15090__b1237514017556">Description</strong><pre class="screen" id="dli_08_15090__screen18375144075516">TIMESTAMP <strong id="dli_08_15090__b8855713205019">TO_TIMESTAMP</strong>(string1[, string2])</pre>
|
|
</li><li id="dli_08_15090__li43759408556"><strong id="dli_08_15090__b3375104020552">Input parameters</strong>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table15375040115511" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row1837524014551"><th align="left" class="cellrowborder" valign="top" width="22.132213221322132%" id="mcps1.3.36.2.3.2.1.4.1.1"><p id="dli_08_15090__p737574085515">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="20.13201320132013%" id="mcps1.3.36.2.3.2.1.4.1.2"><p id="dli_08_15090__p6375440205511">Data Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="57.73577357735774%" id="mcps1.3.36.2.3.2.1.4.1.3"><p id="dli_08_15090__p1637584025518">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row137554045517"><td class="cellrowborder" valign="top" width="22.132213221322132%" headers="mcps1.3.36.2.3.2.1.4.1.1 "><p id="dli_08_15090__p1375104014557">string1</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.13201320132013%" headers="mcps1.3.36.2.3.2.1.4.1.2 "><p id="dli_08_15090__p437544075515">STRING</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.73577357735774%" headers="mcps1.3.36.2.3.2.1.4.1.3 "><p id="dli_08_15090__p9375940155510">SQL timestamp string. If the value is not in the required format, <strong id="dli_08_15090__b20783308134495">NULL</strong> is returned.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_15090__row537564019551"><td class="cellrowborder" valign="top" width="22.132213221322132%" headers="mcps1.3.36.2.3.2.1.4.1.1 "><p id="dli_08_15090__p1837634015515">string2</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.13201320132013%" headers="mcps1.3.36.2.3.2.1.4.1.2 "><p id="dli_08_15090__p1437684019555">STRING</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.73577357735774%" headers="mcps1.3.36.2.3.2.1.4.1.3 "><p id="dli_08_15090__p1837684075519">Date format. If this parameter is not specified, the default format is <strong id="dli_08_15090__b6181699374495">yyyy-MM-dd HH:mm:ss</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="dli_08_15090__li1337654019555"><strong id="dli_08_15090__b737615407558">Example</strong><ul id="dli_08_15090__ul15376134055514"><li id="dli_08_15090__li037684075520">Test statement<pre class="screen" id="dli_08_15090__screen1537634018559">SELECT
|
|
TO_TIMESTAMP('1997-04-25', 'yyyy-MM-dd') AS `result`,
|
|
TO_TIMESTAMP('1997-04-25 00:00:00') AS `result2`,
|
|
TO_TIMESTAMP('1997-04-25 00:00:00', 'yyyy-MM-dd HH:mm:ss') AS `result3`
|
|
FROM
|
|
testtable;</pre>
|
|
</li><li id="dli_08_15090__li143761940165517">Test result
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_15090__table1037617406551" frame="border" border="1" rules="all"><thead align="left"><tr id="dli_08_15090__row11376204035511"><th align="left" class="cellrowborder" valign="top" width="18.459999999999997%" id="mcps1.3.36.2.4.2.2.1.1.4.1.1"><p id="dli_08_15090__p1237718400553">result</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="16.97%" id="mcps1.3.36.2.4.2.2.1.1.4.1.2"><p id="dli_08_15090__p16377164010559">result2</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="64.57000000000001%" id="mcps1.3.36.2.4.2.2.1.1.4.1.3"><p id="dli_08_15090__p53774408551">result3</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_15090__row63771540205512"><td class="cellrowborder" valign="top" width="18.459999999999997%" headers="mcps1.3.36.2.4.2.2.1.1.4.1.1 "><p id="dli_08_15090__p53776407552">1997-04-25 00:00</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.97%" headers="mcps1.3.36.2.4.2.2.1.1.4.1.2 "><p id="dli_08_15090__p123776402553">1997-04-25 00:00</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="64.57000000000001%" headers="mcps1.3.36.2.4.2.2.1.1.4.1.3 "><p id="dli_08_15090__p193771540125518">1997-04-25 00:00</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dli_08_15085.html">Built-In Functions</a></div>
|
|
</div>
|
|
</div>
|
|
|