summaryrefslogtreecommitdiffstats
path: root/source/text/scalc/01/04060102.xhp
blob: 2e1fd17996a96cf4e68909d1074541c73ba3f06e (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
<?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="textscalc0104060102xml" indexer="include">
    <title id="tit" xml-lang="en-US">Date &amp; Time Functions</title>
    <filename>/text/scalc/01/04060102.xhp</filename>
  </topic>
</meta>

<body>
<bookmark xml-lang="en-US" branch="index" id="bm_id3154536">
  <bookmark_value>date and time functions</bookmark_value>
  <bookmark_value>functions; date &amp; time</bookmark_value>
  <bookmark_value>Function Wizard; date &amp; time</bookmark_value>
</bookmark>
<h1 id="hd_id3154536"><variable id="h1">Date &amp; Time Functions</variable></h1>
<paragraph id="par_id3153973" role="paragraph" xml-lang="en-US"><variable id="datumzeittext">These spreadsheet functions are used for inserting and editing dates and times. </variable></paragraph>

<section id="howtoget">
<embed href="text/scalc/00/00000404.xhp#eikadaze"/>
</section>

<section id="ADD_note">
<note id="par_idN10600">The functions whose names end with _ADD or _EXCEL2003 return the same results as the corresponding Microsoft Excel 2003 functions without the suffix. Use the functions without suffix to get results based on international standards.</note>
</section>
<paragraph id="par_id3150437" role="paragraph" xml-lang="en-US">$[officename] internally handles a date/time value as a numerical value. If you assign the numbering format "Number" to a date or time value, it is converted to a number. For example, 01/01/2000 12:00 PM, converts to 36526.5. The value preceding the decimal point corresponds to the date; the value following the decimal point corresponds to the time. If you do not want to see this type of numerical date or time representation, change the number format (date or time) accordingly. To do this, select the cell containing the date or time value, call its context menu and select <emph>Format Cells</emph>. The <emph>Numbers</emph> tab page contains the functions for defining the number format.</paragraph>

<section id="datebase">
<h2 id="hd_id2408825">Date base for day zero</h2>
<paragraph id="par_id9988402" role="paragraph" xml-lang="en-US">Dates are calculated as offsets from a starting day zero. You can set the day zero to be one of the following:</paragraph>

<table id="tbl_id1661427">
  <tablerow>
    <tablecell>
      <paragraph id="par_id6401257" role="tablehead" xml-lang="en-US">Date base</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id5841242" role="tablehead" xml-lang="en-US">Use</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id6794030" role="tablecontent" xml-lang="en-US">'12/30/1899'</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id7096774" role="tablecontent" xml-lang="en-US">(default)</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id5699942" role="tablecontent" xml-lang="en-US">'01/01/1900'</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id6420484" role="tablecontent" xml-lang="en-US">(used in former StarCalc 1.0)</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id6986602" role="tablecontent" xml-lang="en-US">'01/01/1904'</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id616779" role="tablecontent" xml-lang="en-US">(used in Apple software)</paragraph>
    </tablecell>
  </tablerow>
</table>
</section>
<paragraph id="par_id791039" role="paragraph" xml-lang="en-US">Choose <switchinline select="sys"><caseinline select="MAC"><emph>%PRODUCTNAME - Preferences</emph>
</caseinline><defaultinline><emph>Tools - Options</emph></defaultinline></switchinline><emph> - %PRODUCTNAME Calc - Calculate</emph> to select the date base.</paragraph>
<warning id="par_id1953489">When you copy and paste cells containing date values between different spreadsheets, both spreadsheet documents must be set to the same date base. If date bases differ, the displayed date values will change!</warning>

<h2 id="hd_id757469">Two digits years</h2>
<paragraph id="par_id3149720" role="paragraph" xml-lang="en-US">In <switchinline select="sys"><caseinline select="MAC"><emph>%PRODUCTNAME - Preferences</emph>
</caseinline><defaultinline><emph>Tools - Options</emph></defaultinline></switchinline><emph> - $[officename] - General</emph> you find the area <emph>Year (two digits)</emph>. This sets the period for which two-digit information applies. Note that changes made here have an effect on some of the following functions.</paragraph>
<section id="datenumberinfo">
<note id="par_id3150654">When entering dates as part of formulas, slashes or dashes used as date separators are interpreted as arithmetic operators. Therefore, dates entered in this format are not recognized as dates and result in erroneous calculations. To keep dates from being interpreted as parts of formulas use the DATE function, for example, DATE(1954;7;20), or place the date in quotation marks and use the ISO 8601 notation, for example, "1954-07-20". Avoid using locale dependent date formats such as "07/20/54", the calculation may produce errors if the document is loaded under different locale settings.</note>
</section>
<section id="datenumberwarn">
    <tip id="par_id571535118151091">Unambiguous conversion is possible for ISO 8601 dates and times in their extended formats with separators. If a <emph>#VALUE!</emph> error occurs, then unselect <emph>Generate #VALUE! error</emph> in <switchinline select="sys"><caseinline select="MAC"><emph>%PRODUCTNAME - Preferences</emph></caseinline><defaultinline><emph>Tools - Options</emph></defaultinline></switchinline> <emph>- %PRODUCTNAME Calc - Formula</emph>, button <emph>Details...</emph> in section "Detailed Calculation Settings", <emph>Conversion from text to number</emph> list box.</tip>
</section>

<note id="par_id651547654187646">Time zone information is not used in Date and Time functions and cells.</note>

<h2 id="par_idN1067A">Functions</h2>
<section id="datetimefunctions">
    <paragraph role="paragraph" id="par_id31577531529079" localize="false"><embedvar href="text/scalc/01/04060102.xhp#h1" markup="ignore"/></paragraph>

<paragraph id="par_id6854457" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_date.xhp#date"/> </paragraph>
<paragraph id="par_id6354457" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_datedif.xhp#datedif"/> </paragraph>
<paragraph id="par_id3372295" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_datevalue.xhp#datevalue"/> </paragraph>
<paragraph id="par_id5375835" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_day.xhp#day"/> </paragraph>
<paragraph id="par_id1208838" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_days.xhp#days"/> </paragraph>
<paragraph id="par_id7679982" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_days360.xhp#days360"/> </paragraph>
<paragraph id="par_id1074251" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_eastersunday.xhp#eastersunday"/> </paragraph>
<paragraph id="par_id5684377" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_edate.xhp#edate"/> </paragraph>
<paragraph id="par_id1346781" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_eomonth.xhp#eomonth"/> </paragraph>
<paragraph id="par_id224005" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_hour.xhp#hour"/> </paragraph>
<paragraph id="par_id3886533" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_isoweeknum.xhp#isoweeknum"/> </paragraph>
<paragraph id="par_id3953062" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_minute.xhp#minute"/> </paragraph>
<paragraph id="par_id2579729" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_month.xhp#month"/> </paragraph>
<paragraph id="par_id8951384" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_networkdays.xhp#networkdays"/> </paragraph>
<paragraph id="par_id231020162315043955" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_networkdays.intl.xhp#networkdaysintl"/> </paragraph>
<paragraph id="par_id6501968" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_now.xhp#now"/> </paragraph>
<paragraph id="par_id372325" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_second.xhp#second"/> </paragraph>
<paragraph id="par_id2354503" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_time.xhp#time"/> </paragraph>
<paragraph id="par_id7765434" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_timevalue.xhp#timevalue"/> </paragraph>
<paragraph id="par_id7576525" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_today.xhp#today"/> </paragraph>
<paragraph id="par_id9172643" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_weekday.xhp#weekday"/> </paragraph>
<paragraph id="par_id3886532" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_weeknum.xhp#weeknum"/> </paragraph>
<paragraph id="par_id614947" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_weeknumadd.xhp#weeknumadd"/> </paragraph>
<paragraph id="par_id3886534" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_weeknum_ooo.xhp#weeknum_ooo"/> </paragraph>
<paragraph id="par_idN10683" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_workday.xhp#workday"/> </paragraph>
<paragraph id="par_id231020163315043955" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_workday.intl.xhp#workdaysintl"/> </paragraph>
<paragraph id="par_id641193" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_year.xhp#year"/> </paragraph>
<paragraph id="par_id5189062" role="paragraph" localize="false" xml-lang="en-US"> <embedvar href="text/scalc/01/func_yearfrac.xhp#yearfrac"/> </paragraph>
</section>

<section id="relatedtopics">
<embed href="text/scalc/01/04060100.xhp#drking"/>
</section>
</body>
</helpdocument>