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>
51 lines
5.9 KiB
HTML
51 lines
5.9 KiB
HTML
<a name="dli_spark_weekofyear"></a><a name="dli_spark_weekofyear"></a>
|
|
|
|
<h1 class="topictitle1">weekofyear</h1>
|
|
<div id="body8662426"><p id="dli_spark_weekofyear__en-us_topic_0000001696210585_p18471163815215">This function is used to return the week number (from 0 to 53) of a specified date.</p>
|
|
<div class="section" id="dli_spark_weekofyear__en-us_topic_0000001696210585_section45291954203217"><h4 class="sectiontitle">Syntax</h4><pre class="screen" id="dli_spark_weekofyear__en-us_topic_0000001696210585_screen16141162410365">weekofyear(string date)</pre>
|
|
</div>
|
|
<div class="section" id="dli_spark_weekofyear__en-us_topic_0000001696210585_section992014913317"><h4 class="sectiontitle">Parameters</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_spark_weekofyear__en-us_topic_0000001696210585_table1311123023717" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameter</caption><thead align="left"><tr id="dli_spark_weekofyear__en-us_topic_0000001696210585_row81123018371"><th align="left" class="cellrowborder" valign="top" width="19.220000000000002%" id="mcps1.3.3.2.2.5.1.1"><p id="dli_spark_weekofyear__en-us_topic_0000001696210585_p911153012374">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="13.43%" id="mcps1.3.3.2.2.5.1.2"><p id="dli_spark_weekofyear__en-us_topic_0000001696210585_p17114302373">Mandatory</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="20.62%" id="mcps1.3.3.2.2.5.1.3"><p id="dli_spark_weekofyear__en-us_topic_0000001696210585_p81173023718">Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="46.73%" id="mcps1.3.3.2.2.5.1.4"><p id="dli_spark_weekofyear__en-us_topic_0000001696210585_p811113063717">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_spark_weekofyear__en-us_topic_0000001696210585_row1211183073714"><td class="cellrowborder" valign="top" width="19.220000000000002%" headers="mcps1.3.3.2.2.5.1.1 "><p id="dli_spark_weekofyear__en-us_topic_0000001696210585_p71113305371">date</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.43%" headers="mcps1.3.3.2.2.5.1.2 "><p id="dli_spark_weekofyear__en-us_topic_0000001696210585_p161153083720">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.62%" headers="mcps1.3.3.2.2.5.1.3 "><p id="dli_spark_weekofyear__en-us_topic_0000001696210585_p34163588472">DATE or STRING</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="46.73%" headers="mcps1.3.3.2.2.5.1.4 "><p id="dli_spark_weekofyear__en-us_topic_0000001696210585_p10994193319443">Date that needs to be processed</p>
|
|
<div class="p" id="dli_spark_weekofyear__en-us_topic_0000001696210585_p16460192113371">The following formats are supported:<ul id="dli_spark_weekofyear__en-us_topic_0000001696210585_ul1476862843819"><li id="dli_spark_weekofyear__en-us_topic_0000001696210585_li9768132843817">yyyy-mm-dd</li><li id="dli_spark_weekofyear__en-us_topic_0000001696210585_li16768528153818">yyyy-mm-dd hh:mi:ss</li><li id="dli_spark_weekofyear__en-us_topic_0000001696210585_li18768192815382">yyyy-mm-dd hh:mi:ss.ff3</li></ul>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="dli_spark_weekofyear__en-us_topic_0000001696210585_section210162513312"><h4 class="sectiontitle">Return Values</h4><p id="dli_spark_weekofyear__en-us_topic_0000001696210585_p1985525218396">The return value is of the INT type.</p>
|
|
<div class="note" id="dli_spark_weekofyear__en-us_topic_0000001696210585_note1641625019416"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="dli_spark_weekofyear__en-us_topic_0000001696210585_ul25918820215"><li id="dli_spark_weekofyear__en-us_topic_0000001696210585_li4591982216">If the value of <strong id="dli_spark_weekofyear__en-us_topic_0000001696210585_b73382142635756">date</strong> is not of the DATE or STRING type, the error message "data type mismatch" is displayed.</li><li id="dli_spark_weekofyear__en-us_topic_0000001696210585_li1214212419387">If the value of <strong id="dli_spark_weekofyear__en-us_topic_0000001696210585_b1564873773587">date</strong> is of the DATE or STRING type but is not in one of the supported formats, <strong id="dli_spark_weekofyear__en-us_topic_0000001696210585_b12462305383587">NULL</strong> is returned.</li><li id="dli_spark_weekofyear__en-us_topic_0000001696210585_li814214420384">If the value of <strong id="dli_spark_weekofyear__en-us_topic_0000001696210585_b7444217535824">date</strong> is <strong id="dli_spark_weekofyear__en-us_topic_0000001696210585_b137557809635824">NULL</strong>, <strong id="dli_spark_weekofyear__en-us_topic_0000001696210585_b139767011135824">NULL</strong> is returned.</li></ul>
|
|
</div></div>
|
|
</div>
|
|
<div class="section" id="dli_spark_weekofyear__en-us_topic_0000001696210585_section13277192233920"><h4 class="sectiontitle">Example Code</h4><p id="dli_spark_weekofyear__en-us_topic_0000001696210585_p981314347406">The value <strong id="dli_spark_weekofyear__en-us_topic_0000001696210585_b77751458164214">33</strong> is returned.</p>
|
|
<pre class="screen" id="dli_spark_weekofyear__en-us_topic_0000001696210585_screen1663723984012">select weekofyear('2023-08-16 10:54:36');</pre>
|
|
<p id="dli_spark_weekofyear__en-us_topic_0000001696210585_p11813434164014">The value <strong id="dli_spark_weekofyear__en-us_topic_0000001696210585_b1611111344310">NULL</strong> is returned.</p>
|
|
<pre class="screen" id="dli_spark_weekofyear__en-us_topic_0000001696210585_screen11847204414012">select weekofyear('20230816');</pre>
|
|
<p id="dli_spark_weekofyear__en-us_topic_0000001696210585_p38139347404">The value <strong id="dli_spark_weekofyear__en-us_topic_0000001696210585_b188814674316">NULL</strong> is returned.</p>
|
|
<pre class="screen" id="dli_spark_weekofyear__en-us_topic_0000001696210585_screen107749174010">select weekofyear(null);</pre>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dli_08_0471.html">Date Functions</a></div>
|
|
</div>
|
|
</div>
|
|
|