<?xml version="1.0" encoding="UTF-8"?>
<helpdocument version="1.0">
<!--
 * 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 .
-->

<meta>
  <topic id="textscalc01func_weekdayxml" indexer="include" status="PUBLISH">
    <title id="tit" xml-lang="en-US">WEEKDAY </title>
    <filename>/text/scalc/01/func_weekday.xhp</filename>
  </topic>
</meta>

<body>

<bookmark xml-lang="en-US" branch="index" id="bm_id3154925">
  <bookmark_value>WEEKDAY function</bookmark_value>
</bookmark>

<bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_WOCHENTAG" id="bm_id3152359" localize="false"/>

<paragraph id="hd_id3154925" role="heading" level="2" xml-lang="en-US"><variable id="weekday"><link href="text/scalc/01/func_weekday.xhp">WEEKDAY</link> </variable></paragraph>
<paragraph id="par_id3154228" role="paragraph" xml-lang="en-US"><ahelp hid="HID_FUNC_WOCHENTAG">Returns the day of the week for the given date value.</ahelp> The day is returned as an integer between 1 (Sunday) and 7 (Saturday) if no type or type=1 is specified. For other types, see the table below.</paragraph>

<embed href="text/scalc/01/common_func.xhp#sectionsyntax"/>
<paragraph id="par_id3149033" role="code" xml-lang="en-US">WEEKDAY(Number; Type)</paragraph>
<paragraph id="par_id3149046" role="paragraph" xml-lang="en-US"> <emph>Number</emph>, as a date value, is a decimal for which the weekday is to be returned.</paragraph>
<paragraph id="par_id3154394" role="paragraph" xml-lang="en-US"> <emph>Type</emph> is optional and determines the type of calculation. </paragraph>

<table id="tbl_050220170549191947">
  <tablerow>
    <tablecell>
      <paragraph id="par_id050220170615596613" role="tablehead" xml-lang="en-US">Type</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id05022017061559141" role="tablehead" xml-lang="en-US">Weekday number returned</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id050220170615599995" role="tablecontent" xml-lang="en-US">1 or omitted</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id050220170615597231" role="tablecontent" xml-lang="en-US">1 (Sunday) through 7 (Saturday). For compatibility with Microsoft Excel.</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id050220170609471518" role="tablecontent" localize="false" xml-lang="en-US">2</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id050220170615596260" role="tablecontent" xml-lang="en-US">1 (Monday) through 7 (Sunday).</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id050220170609564629" role="tablecontent" localize="false" xml-lang="en-US">3</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id050220170615597630" role="tablecontent" xml-lang="en-US">0 (Monday) through 6 (Sunday)</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id050220170609575426" role="tablecontent" localize="false" xml-lang="en-US">11</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id050220170615592023" role="tablecontent" xml-lang="en-US">1 (Monday) through 7 (Sunday).</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id050220170609583004" role="tablecontent" localize="false" xml-lang="en-US">12</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id050220170615591349" role="tablecontent" xml-lang="en-US">1 (Tuesday) through 7 (Monday).</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id05022017060959167" role="tablecontent" localize="false" xml-lang="en-US">13</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id050220170615593664" role="tablecontent" xml-lang="en-US">1 (Wednesday) through 7 (Tuesday).</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id050220170609591975" role="tablecontent" localize="false" xml-lang="en-US">14</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id050220170615599110" role="tablecontent" xml-lang="en-US">1 (Thursday) through 7 (Wednesday).</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id05022017061000285" role="tablecontent" localize="false" xml-lang="en-US">15</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id05022017061600535" role="tablecontent" xml-lang="en-US">1 (Friday) through 7 (Thursday).</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id050220170610017288" role="tablecontent" localize="false" xml-lang="en-US">16</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id050220170616003219" role="tablecontent" xml-lang="en-US">1 (Saturday) through 7 (Friday).</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id050220170610027543" role="tablecontent" localize="false" xml-lang="en-US">17</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id050220170616002095" role="tablecontent" xml-lang="en-US">1 (Sunday) through 7 (Saturday).</paragraph>
    </tablecell>
  </tablerow>
</table>

<paragraph id="par_id3156188" role="note" xml-lang="en-US">These values apply only to the standard date format that you select under <switchinline select="sys"><caseinline select="MAC"><item type="menuitem">%PRODUCTNAME - Preferences</item>
</caseinline><defaultinline><item type="menuitem">Tools - Options</item></defaultinline></switchinline><item type="menuitem">- %PRODUCTNAME Calc - Calculate</item>.</paragraph>
<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 id="par_id3150317" role="paragraph" xml-lang="en-US"><item type="input">=WEEKDAY("2000-06-14")</item> returns 4 (the Type parameter is missing, therefore the standard count is used. The standard count starts with Sunday as day number 1. June 14, 2000 was a Wednesday and therefore day number 4).</paragraph>
<paragraph id="par_id3153174" role="paragraph" xml-lang="en-US"><item type="input">=WEEKDAY("1996-07-24";2)</item> returns 3 (the Type parameter is 2, therefore Monday is day number 1. July 24, 1996 was a Wednesday and therefore day number 3).</paragraph>
<paragraph id="par_id3153525" role="paragraph" xml-lang="en-US"><item type="input">=WEEKDAY("1996-07-24";1)</item> returns 4 (the Type parameter is 1, therefore Sunday is day number 1. July 24, 1996 was a Wednesday and therefore day number 4).</paragraph>
<paragraph id="par_id050220170616006699" role="paragraph" xml-lang="en-US"><item type="input">=WEEKDAY("2017-05-02";14)</item> returns 6 (the Type parameter is 14, therefore Thursday is day number 1. May 2, 2017 was a Tuesday and therefore day number 6)</paragraph>
<paragraph id="par_id3150575" role="paragraph" xml-lang="en-US"><item type="input">=WEEKDAY(NOW())</item> returns the number of the current day.</paragraph>
<paragraph id="par_id3150588" role="tip" xml-lang="en-US">To obtain a function indicating whether a day in A1 is a business day, use the IF and WEEKDAY functions as follows: <br/><item type="input">IF(WEEKDAY(A1;2)&lt;6;"Business day";"Weekend")</item></paragraph>
</body>

</helpdocument>
