1<?xml version="1.0" encoding="UTF-8"?>
2
3
4<!--***********************************************************************
5 *
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 *
8 * Copyright 2000, 2010 Oracle and/or its affiliates.
9 *
10 * OpenOffice.org - a multi-platform office productivity suite
11 *
12 * This file is part of OpenOffice.org.
13 *
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
17 *
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
23 *
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org.  If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
28 *
29 ************************************************************************-->
30
31<helpdocument version="1.0">
32<meta>
33<topic id="textsbasicshared03030110xhp" indexer="include" status="PUBLISH">
34<title id="tit" xml-lang="en-US">DateAdd Function [Runtime]</title>
35<filename>/text/sbasic/shared/03030110.xhp</filename>
36</topic>
37<history>
38<created date="2005-04-25T12:44:45">DateAdd</created>
39<lastedited date="2005-04-26T10:20:22">checked</lastedited>
40</history>
41</meta>
42<body>
43<section id="dateadd">
44<bookmark xml-lang="en-US" branch="index" id="bm_id6269417"><bookmark_value>DateAdd function</bookmark_value>
45</bookmark>
46<paragraph role="heading" id="par_idN10548" xml-lang="en-US" level="1" l10n="NEW"><link href="text/sbasic/shared/03030110.xhp">DateAdd Function [Runtime]</link></paragraph>
47<paragraph role="paragraph" id="par_idN10558" xml-lang="en-US" l10n="NEW">Adds a date interval to a given date a number of times and returns the resulting date.</paragraph>
48</section>
49<paragraph role="heading" id="par_idN1055B" xml-lang="en-US" level="2" l10n="NEW">Syntax:</paragraph>
50<paragraph role="paragraph" id="par_idN1055F" xml-lang="en-US" l10n="NEW">DateAdd (Add, Count, Date)</paragraph>
51<paragraph role="heading" id="par_idN1061E" xml-lang="en-US" level="2" l10n="NEW">Return value:</paragraph>
52<paragraph role="paragraph" id="par_idN10622" xml-lang="en-US" l10n="NEW">A Variant containing a date.</paragraph>
53<paragraph role="heading" id="par_idN10625" xml-lang="en-US" level="2" l10n="NEW">Parameters:</paragraph>
54<paragraph role="paragraph" id="par_idN10629" xml-lang="en-US" l10n="NEW">Add - A string expression from the following table, specifying the date interval.</paragraph>
55<section id="datetable">
56<table id="tbl_id7568285">
57<tablerow>
58<tablecell colspan="" rowspan="">
59<paragraph role="tablehead" id="par_idN10636" xml-lang="en-US" l10n="NEW">Add (string value)</paragraph>
60</tablecell>
61<tablecell colspan="" rowspan="">
62<paragraph role="tablehead" id="par_idN1063C" xml-lang="en-US" l10n="NEW">Explanation</paragraph>
63</tablecell>
64</tablerow>
65<tablerow>
66<tablecell colspan="" rowspan="">
67<paragraph role="tablecontent" id="par_idN10643" xml-lang="en-US" l10n="NEW">yyyy</paragraph>
68</tablecell>
69<tablecell colspan="" rowspan="">
70<paragraph role="tablecontent" id="par_idN10649" xml-lang="en-US" l10n="NEW">Year</paragraph>
71</tablecell>
72</tablerow>
73<tablerow>
74<tablecell colspan="" rowspan="">
75<paragraph role="tablecontent" id="par_idN10650" xml-lang="en-US" l10n="NEW">q</paragraph>
76</tablecell>
77<tablecell colspan="" rowspan="">
78<paragraph role="tablecontent" id="par_idN10656" xml-lang="en-US" l10n="NEW">Quarter</paragraph>
79</tablecell>
80</tablerow>
81<tablerow>
82<tablecell colspan="" rowspan="">
83<paragraph role="tablecontent" id="par_idN1065D" xml-lang="en-US" l10n="NEW">m</paragraph>
84</tablecell>
85<tablecell colspan="" rowspan="">
86<paragraph role="tablecontent" id="par_idN10663" xml-lang="en-US" l10n="NEW">Month</paragraph>
87</tablecell>
88</tablerow>
89<tablerow>
90<tablecell colspan="" rowspan="">
91<paragraph role="tablecontent" id="par_idN1066A" xml-lang="en-US" l10n="NEW">y</paragraph>
92</tablecell>
93<tablecell colspan="" rowspan="">
94<paragraph role="tablecontent" id="par_idN10670" xml-lang="en-US" l10n="NEW">Day of year</paragraph>
95</tablecell>
96</tablerow>
97<tablerow>
98<tablecell colspan="" rowspan="">
99<paragraph role="tablecontent" id="par_idN10677" xml-lang="en-US" l10n="NEW">w</paragraph>
100</tablecell>
101<tablecell colspan="" rowspan="">
102<paragraph role="tablecontent" id="par_idN1067D" xml-lang="en-US" l10n="NEW">Weekday</paragraph>
103</tablecell>
104</tablerow>
105<tablerow>
106<tablecell colspan="" rowspan="">
107<paragraph role="tablecontent" id="par_idN10684" xml-lang="en-US" l10n="NEW">ww</paragraph>
108</tablecell>
109<tablecell colspan="" rowspan="">
110<paragraph role="tablecontent" id="par_idN1068A" xml-lang="en-US" l10n="NEW">Week of year</paragraph>
111</tablecell>
112</tablerow>
113<tablerow>
114<tablecell colspan="" rowspan="">
115<paragraph role="tablecontent" id="par_idN10691" xml-lang="en-US" l10n="NEW">d</paragraph>
116</tablecell>
117<tablecell colspan="" rowspan="">
118<paragraph role="tablecontent" id="par_idN10697" xml-lang="en-US" l10n="NEW">Day</paragraph>
119</tablecell>
120</tablerow>
121<tablerow>
122<tablecell colspan="" rowspan="">
123<paragraph role="tablecontent" id="par_idN1069E" xml-lang="en-US" l10n="NEW">h</paragraph>
124</tablecell>
125<tablecell colspan="" rowspan="">
126<paragraph role="tablecontent" id="par_idN106A4" xml-lang="en-US" l10n="NEW">Hour</paragraph>
127</tablecell>
128</tablerow>
129<tablerow>
130<tablecell colspan="" rowspan="">
131<paragraph role="tablecontent" id="par_idN106AB" xml-lang="en-US" l10n="NEW">n</paragraph>
132</tablecell>
133<tablecell colspan="" rowspan="">
134<paragraph role="tablecontent" id="par_idN106B1" xml-lang="en-US" l10n="NEW">Minute</paragraph>
135</tablecell>
136</tablerow>
137<tablerow>
138<tablecell colspan="" rowspan="">
139<paragraph role="tablecontent" id="par_idN106B8" xml-lang="en-US" l10n="NEW">s</paragraph>
140</tablecell>
141<tablecell colspan="" rowspan="">
142<paragraph role="tablecontent" id="par_idN106BE" xml-lang="en-US" l10n="NEW">Second</paragraph>
143</tablecell>
144</tablerow>
145</table>
146
147</section>
148<paragraph role="paragraph" id="par_idN106C1" xml-lang="en-US" l10n="NEW">Count - A numerical expression specifying how often the Add interval will be added (Count is positive) or subtracted (Count is negative).</paragraph>
149<paragraph role="paragraph" id="par_idN106C4" xml-lang="en-US" l10n="NEW">Date - A given date or the name of a Variant variable containing a date. The Add value will be added Count times to this value.</paragraph>
150<paragraph role="heading" id="par_idN106C7" xml-lang="en-US" level="2" l10n="NEW">Example:</paragraph>
151<paragraph role="code" id="par_idN106CB" xml-lang="en-US" l10n="NEW">Sub example_dateadd</paragraph>
152<paragraph role="code" id="par_idN106CE" xml-lang="en-US" l10n="NEW">msgbox DateAdd("m", 1, "1/31/2004") &amp;" - "&amp; DateAdd("m", 1, "1/31/2005")</paragraph>
153<paragraph role="code" id="par_idN106D1" xml-lang="en-US" l10n="NEW">End Sub</paragraph>
154</body>
155</helpdocument>
156