summaryrefslogtreecommitdiff
path: root/helpcontent2/source/text/scalc/01/func_datedif.xhp
blob: 37190223b61dad0ff28c174f8c0ece88b60b1971 (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
<?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"/><paragraph role="heading" id="hd_id3155511" xml-lang="en-US" level="2"><variable id="datedif"><link href="text/scalc/01/func_datedif.xhp">DATEDIF</link>
</variable></paragraph>
<paragraph role="paragraph" id="par_id3153551" xml-lang="en-US"><ahelp hid="HID_FUNC_DATUM">This function returns the number of whole days, months or years between Start date and End date.</ahelp></paragraph>
<paragraph role="heading" id="hd_id3148590" xml-lang="en-US" level="3">Syntax</paragraph>
<paragraph role="code" id="par_id3150474" xml-lang="en-US">DATEDIF(Start date; End date; Interval)</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, accepted values are "d", "m", "y", "ym", "md" or "yd".</paragraph>
<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">"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">"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">"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">"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">"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">"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>
<paragraph role="heading" id="hd_id3147477" xml-lang="en-US" level="3">Example</paragraph>
<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. <item type="input">=DATEDIF("1974-04-17";"2012-06-13";"ym")</item> yields 1. <item type="input">=DATEDIF("1974-04-17";"2012-06-13";"md")</item> yields 27. 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("1974-04-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";"2012-06-13";"yd")</item> yields 57, his birthday was 57 days ago.</paragraph>
</body>
</helpdocument>