<?xml version="1.0" encoding="UTF-8"?>
<!--
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 -->
<helpdocument version="1.0">
<meta>
<topic id="textscalc01func_weeknumxml" indexer="include" status="PUBLISH">
<title id="tit" xml-lang="en-US">WEEKNUM</title>
<filename>/text/scalc/01/func_weeknum.xhp</filename>
</topic>
</meta>
<body>
<bookmark xml-lang="en-US" branch="index" id="bm_id3159161"><bookmark_value>WEEKNUM function</bookmark_value>
</bookmark>
<bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_KALENDERWOCHE" id="bm_id3158403" localize="false"/><paragraph role="heading" id="hd_id3159161" xml-lang="en-US" level="2"><variable id="weeknum"><link href="text/scalc/01/func_weeknum.xhp">WEEKNUM</link>
</variable></paragraph>
<paragraph role="paragraph" id="par_id3149770" xml-lang="en-US"><ahelp hid="HID_FUNC_KALENDERWOCHE">WEEKNUM calculates the week number of the year for the internal date value as defined in ODF OpenFormula and compatible with other spreadsheet applications.</ahelp></paragraph>
<paragraph role="paragraph" id="par_id3147220" xml-lang="en-US">Supported are two week numbering systems:</paragraph>
<table id="tab_id481535122363435">
    <tablerow>
        <tablecell>
            <paragraph id="par_id851535122363435" role="tablehead" xml-lang="en-US">System</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id901535122363436" role="tablehead" xml-lang="en-US" localize="false">Description</paragraph>
        </tablecell>
    </tablerow>
    <tablerow>
        <tablecell>
            <paragraph id="par_id691535122363437" role="tablecontent" xml-lang="en-US">System 1</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id3147221" role="tablecontent" xml-lang="en-US">The week containing January 1 is the first week of the year, and is numbered week 1.</paragraph>
        </tablecell>
    </tablerow>
    <tablerow>
        <tablecell>
            <paragraph id="par_id741535122455285" role="tablecontent" xml-lang="en-US" >System 2</paragraph>
        </tablecell>
        <tablecell>
            <paragraph role="tablecontent" id="par_id3147222" xml-lang="en-US">The week containing the first Thursday of the year is the first week of the year, and is numbered week 1. That means that week number 1 of any year is the week that contains January 4th. ISO 8601 defines this system and that the week starts on Monday.</paragraph>
        </tablecell>
    </tablerow>
</table>
<embed href="text/scalc/01/common_func.xhp#sectionsyntax"/>
<paragraph role="code" id="par_id3147236" xml-lang="en-US">WEEKNUM(Number [; Mode])</paragraph>
<paragraph role="paragraph" id="par_id3147511" xml-lang="en-US">
<emph>Number</emph> is the internal date number.</paragraph>
<paragraph role="paragraph" id="par_id3154269" xml-lang="en-US">
<emph>Mode</emph> sets the start of the week and the week numbering system. This parameter is optional, if omitted the default value is 1.</paragraph>
<table id="tab_id491535122633826">
    <tablerow>
        <tablecell>
            <paragraph id="par_id961535122993923" role="tablehead" xml-lang="en-US" >System</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id151535122633826" role="tablehead" xml-lang="en-US">Mode</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id231535122633827" role="tablehead" xml-lang="en-US">Day of the week</paragraph>
        </tablecell>
    </tablerow>
    <tablerow>
        <tablecell rowspan="9">
            <paragraph id="par_id531535124180000" role="tablecontents" xml-lang="en-US" >System 1</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id931535122633827" role="tablecontent" xml-lang="en-US" localize="false">1</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id351535122633828" role="tablecontent" xml-lang="en-US">Sunday</paragraph>
        </tablecell>
    </tablerow>
    <tablerow>
        <tablecell>
            <paragraph id="par_id441535122735565" role="tablecontents" xml-lang="en-US" localize="false">2</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id591535122756686" role="tablecontents" xml-lang="en-US" >Monday</paragraph>
        </tablecell>
    </tablerow>
    <tablerow>
        <tablecell>
            <paragraph id="par_id541535122798459" role="tablecontents" xml-lang="en-US" localize="false">11</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id881535122835126" role="tablecontents" xml-lang="en-US" >Monday</paragraph>
        </tablecell>
    </tablerow>
    <tablerow>
        <tablecell>
            <paragraph id="par_id941535122866815" role="tablecontent" xml-lang="en-US" localize="false">12</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id241535122903569" role="tablecontents" xml-lang="en-US" >Tuesday</paragraph>
        </tablecell>
    </tablerow>
    <tablerow>
        <tablecell>
            <paragraph id="par_id271535124253476" role="tablecontents" xml-lang="en-US" localize="false">13</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id31535124277973" role="tablecontents" xml-lang="en-US" >Wednesday</paragraph>
        </tablecell>
    </tablerow>
    <tablerow>
        <tablecell>
            <paragraph id="par_id281535124290548" role="tablecontents" xml-lang="en-US" localize="false">14</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id21535124310462" role="tablecontents" xml-lang="en-US" >Thursday</paragraph>
        </tablecell>
    </tablerow>
    <tablerow>
        <tablecell>
            <paragraph id="par_id721535124338290" role="tablecontents" xml-lang="en-US" localize="false">15</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id921535124365435" role="tablecontents" xml-lang="en-US" >Friday</paragraph>
        </tablecell>
    </tablerow>
    <tablerow>
        <tablecell>
            <paragraph id="par_id781535124380237" role="tablecontents" xml-lang="en-US" localize="false">16</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id211535124416253" role="tablecontents" xml-lang="en-US" >Saturday</paragraph>
        </tablecell>
    </tablerow>
    <tablerow>
        <tablecell>
            <paragraph id="par_id601535124440320" role="tablecontents" xml-lang="en-US" localize="false" >17</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id461535124473824" role="tablecontents" xml-lang="en-US" >Sunday</paragraph>
        </tablecell>
    </tablerow>
    <tablerow>
        <tablecell rowspan="2">
            <paragraph id="par_id471535124489997" role="tablecontents" xml-lang="en-US" >System 2</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id431535124539573" role="tablecontents" xml-lang="en-US" localize="false">21</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id391535124564520" role="tablecontents" xml-lang="en-US" >Monday (ISO 8601)</paragraph>
        </tablecell>
    </tablerow>
    <tablerow>
        <tablecell>
            <paragraph id="par_id971535124578111" role="tablecontents" xml-lang="en-US" localize="false">150</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id661535124640643" role="tablecontents" xml-lang="en-US" >(ISO 8601, for interoperability with Gnumeric)</paragraph>
        </tablecell>
</tablerow>
</table>
<embed href="text/scalc/01/04060102.xhp#datenumberinfo"/>
<embed href="text/scalc/01/04060102.xhp#datenumberwarn"/>
<embed href="text/scalc/01/common_func.xhp#sectionexample"/>
<paragraph role="paragraph" id="par_id3150704" xml-lang="en-US"><item type="input">=WEEKNUM(DATE(1995;1;1);1)</item>  returns 1</paragraph>
<paragraph role="paragraph" id="par_id3149792" xml-lang="en-US"><item type="input">=WEEKNUM(DATE(1995;1;1);2)</item>  returns 52. If the week starts on Monday, Sunday belongs to the last week of the previous year.</paragraph>
<paragraph role="paragraph" id="par_id3149793" xml-lang="en-US"><item type="input">=WEEKNUM(DATE(1995;1;1);21)</item>  returns 52. Week 1 starts on Monday, 1995-01-02.</paragraph>
<paragraph role="paragraph" id="par_id3149794" xml-lang="en-US"><item type="input">=WEEKNUM(DATE(1999;1;1);21)</item>  returns 53. Week 1 starts on Monday, 1999-01-04.</paragraph>
</body>
</helpdocument>
