summaryrefslogtreecommitdiffstats
path: root/source/text/scalc/01/func_weekday.xhp
blob: f000d5fe77287ce029b1c408dd4352574d756ff6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<?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"/>

<h2 id="hd_id3154925"><variable id="weekday"><link href="text/scalc/01/func_weekday.xhp">WEEKDAY</link> </variable></h2>
<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/ODFF.xhp#odff"/>
<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>

<note id="par_id3156188">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>.</note>
<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>
<tip id="par_id3150588">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></tip>
<section id="relatedtopics">
    <embed href="text/scalc/01/04060102.xhp#datetimefunctions"/>
</section>
</body>

</helpdocument>