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
|
<?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/.
*
-->
<helpdocument version="1.0">
<meta>
<topic id="textscalc01func_datedifxml" indexer="include" status="PUBLISH">
<title id="tit" xml-lang="en-US">DATEDIF</title>
<filename>/text/scalc/01/func_datedif.xhp</filename>
</topic>
</meta>
<body>
<bookmark xml-lang="en-US" branch="index" id="bm_id3155511"><bookmark_value>DATEDIF function</bookmark_value>
</bookmark>
<bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_DATEDIF" id="bm_id3149022" localize="false"/>
<h2 id="hd_id3155511"><variable id="datedif"><link href="text/scalc/01/func_datedif.xhp">DATEDIF</link></variable></h2>
<paragraph role="paragraph" id="par_id3153551" xml-lang="en-US"><ahelp hid="HID_FUNC_DATEDIF">This function returns the number of whole days, months or years between Start date and End date.</ahelp></paragraph>
<embed href="text/scalc/00/avail_release.xhp#3.6"/>
<embed href="text/scalc/01/ODFF.xhp#odff"/>
<embed href="text/scalc/01/common_func.xhp#sectionsyntax"/>
<paragraph role="paragraph" id="par_id531642776283977">
<input>DATEDIF(Start date; End date; Interval)</input>
</paragraph>
<paragraph role="paragraph" id="par_id3152815" xml-lang="en-US">
<emph>Start date</emph> is the date from when the calculation is carried out.</paragraph>
<paragraph role="paragraph" id="par_id3155817" xml-lang="en-US">
<emph>End date</emph> is the date until the calculation is carried out. End date must be later, than Start date.</paragraph>
<paragraph role="paragraph" id="par_id3153183" xml-lang="en-US">
<emph>Interval</emph> is a string that determines how the difference will be calculated. Possible values are "d", "m", "y", "ym", "md" or "yd" regardless of the current language settings.</paragraph>
<embed href="text/scalc/01/04060102.xhp#datenumberinfo"/>
<embed href="text/scalc/01/04060102.xhp#datenumberwarn"/>
<table id="tbl_id1342204">
<tablerow>
<tablecell>
<paragraph role="tablehead" id="par_id5735953" xml-lang="en-US">Value for "Interval"<comment>Do not translate the text values in this column below</comment></paragraph>
</tablecell>
<tablecell>
<paragraph role="tablehead" id="par_id8360850" xml-lang="en-US">Return value</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph role="tablecontent" id="par_id9648731" xml-lang="en-US" localize="false">"d"</paragraph>
</tablecell>
<tablecell>
<paragraph role="tablecontent" id="par_id908841" xml-lang="en-US">Number of whole days between Start date and End date.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph role="tablecontent" id="par_id8193914" xml-lang="en-US" localize="false">"m"</paragraph>
</tablecell>
<tablecell>
<paragraph role="tablecontent" id="par_id9841608" xml-lang="en-US">Number of whole months between Start date and End date.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph role="tablecontent" id="par_id2701803" xml-lang="en-US" localize="false">"y"</paragraph>
</tablecell>
<tablecell>
<paragraph role="tablecontent" id="par_id2136295" xml-lang="en-US">Number of whole years between Start date and End date.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph role="tablecontent" id="par_id9200109" xml-lang="en-US" localize="false">"ym"</paragraph>
</tablecell>
<tablecell>
<paragraph role="tablecontent" id="par_id4186223" xml-lang="en-US">Number of whole months when subtracting years from the difference of Start date and End date.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph role="tablecontent" id="par_id5766472" xml-lang="en-US" localize="false">"md"</paragraph>
</tablecell>
<tablecell>
<paragraph role="tablecontent" id="par_id1491134" xml-lang="en-US">Number of whole days when subtracting years and months from the difference of Start date and End date.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph role="tablecontent" id="par_id5866472" xml-lang="en-US" localize="false">"yd"</paragraph>
</tablecell>
<tablecell>
<paragraph role="tablecontent" id="par_id1591134" xml-lang="en-US">Number of whole days when subtracting years from the difference of Start date and End date.</paragraph>
</tablecell>
</tablerow>
</table>
<embed href="text/scalc/01/common_func.xhp#sectionexample"/>
<paragraph role="paragraph" id="par_id3152589" xml-lang="en-US">
Birthday calculation. A man was born on 1974-04-17. Today is 2012-06-13.</paragraph>
<paragraph role="paragraph" id="par_id3252589" xml-lang="en-US"><item type="input">=DATEDIF("1974-04-17";"2012-06-13";"y")</item> yields 38.</paragraph>
<paragraph role="paragraph" id="par_id451535132395328" xml-lang="en-US"><item type="input">=DATEDIF("1974-04-17";"2012-06-13";"ym")</item> yields 1.</paragraph>
<paragraph role="paragraph" id="par_id611535132402642" xml-lang="en-US"><item type="input">=DATEDIF("1974-04-17";"2012-06-13";"md")</item> yields 27.</paragraph>
<paragraph role="paragraph" id="par_id511535132411940" xml-lang="en-US">So he is 38 years, 1 month and 27 days old.</paragraph>
<paragraph role="paragraph" id="par_id3352589" xml-lang="en-US">
<item type="input">=DATEDIF(DATE(1974,4,17);"2012-06-13";"m")</item> yields 457, he has been living for 457 months.</paragraph>
<paragraph role="paragraph" id="par_id3452589" xml-lang="en-US">
<item type="input">=DATEDIF("1974-04-17";"2012-06-13";"d")</item> yields 13937, he has been living for 13937 days.</paragraph>
<paragraph role="paragraph" id="par_id3752589" xml-lang="en-US">
<item type="input">=DATEDIF("1974-04-17";DATE(2012;06;13);"yd")</item> yields 57, his birthday was 57 days ago.</paragraph>
<section id="relatedtopics">
<embed href="text/scalc/01/04060102.xhp#datetimefunctions"/>
</section>
</body>
</helpdocument>
|