1<?xml version="1.0" encoding="UTF-8"?>
2
3
4<!--***********************************************************
5 *
6 * Licensed to the Apache Software Foundation (ASF) under one
7 * or more contributor license agreements.  See the NOTICE file
8 * distributed with this work for additional information
9 * regarding copyright ownership.  The ASF licenses this file
10 * to you under the Apache License, Version 2.0 (the
11 * "License"); you may not use this file except in compliance
12 * with the License.  You may obtain a copy of the License at
13 *
14 *   http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing,
17 * software distributed under the License is distributed on an
18 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19 * KIND, either express or implied.  See the License for the
20 * specific language governing permissions and limitations
21 * under the License.
22 *
23 ***********************************************************-->
24
25
26
27<helpdocument version="1.0">
28<meta>
29<topic id="textsbasicshared03030110xhp" indexer="include" status="PUBLISH">
30<title id="tit" xml-lang="en-US">DateAdd Function [Runtime]</title>
31<filename>/text/sbasic/shared/03030110.xhp</filename>
32</topic>
33<history>
34<created date="2005-04-25T12:44:45">DateAdd</created>
35<lastedited date="2005-04-26T10:20:22">checked</lastedited>
36</history>
37</meta>
38<body>
39<section id="dateadd">
40<bookmark xml-lang="en-US" branch="index" id="bm_id6269417"><bookmark_value>DateAdd function</bookmark_value>
41</bookmark>
42<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>
43<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>
44</section>
45<paragraph role="heading" id="par_idN1055B" xml-lang="en-US" level="2" l10n="NEW">Syntax:</paragraph>
46<paragraph role="paragraph" id="par_idN1055F" xml-lang="en-US" l10n="NEW">DateAdd (Add, Count, Date)</paragraph>
47<paragraph role="heading" id="par_idN1061E" xml-lang="en-US" level="2" l10n="NEW">Return value:</paragraph>
48<paragraph role="paragraph" id="par_idN10622" xml-lang="en-US" l10n="NEW">A Variant containing a date.</paragraph>
49<paragraph role="heading" id="par_idN10625" xml-lang="en-US" level="2" l10n="NEW">Parameters:</paragraph>
50<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>
51<section id="datetable">
52<table id="tbl_id7568285">
53<tablerow>
54<tablecell colspan="" rowspan="">
55<paragraph role="tablehead" id="par_idN10636" xml-lang="en-US" l10n="NEW">Add (string value)</paragraph>
56</tablecell>
57<tablecell colspan="" rowspan="">
58<paragraph role="tablehead" id="par_idN1063C" xml-lang="en-US" l10n="NEW">Explanation</paragraph>
59</tablecell>
60</tablerow>
61<tablerow>
62<tablecell colspan="" rowspan="">
63<paragraph role="tablecontent" id="par_idN10643" xml-lang="en-US" l10n="NEW">yyyy</paragraph>
64</tablecell>
65<tablecell colspan="" rowspan="">
66<paragraph role="tablecontent" id="par_idN10649" xml-lang="en-US" l10n="NEW">Year</paragraph>
67</tablecell>
68</tablerow>
69<tablerow>
70<tablecell colspan="" rowspan="">
71<paragraph role="tablecontent" id="par_idN10650" xml-lang="en-US" l10n="NEW">q</paragraph>
72</tablecell>
73<tablecell colspan="" rowspan="">
74<paragraph role="tablecontent" id="par_idN10656" xml-lang="en-US" l10n="NEW">Quarter</paragraph>
75</tablecell>
76</tablerow>
77<tablerow>
78<tablecell colspan="" rowspan="">
79<paragraph role="tablecontent" id="par_idN1065D" xml-lang="en-US" l10n="NEW">m</paragraph>
80</tablecell>
81<tablecell colspan="" rowspan="">
82<paragraph role="tablecontent" id="par_idN10663" xml-lang="en-US" l10n="NEW">Month</paragraph>
83</tablecell>
84</tablerow>
85<tablerow>
86<tablecell colspan="" rowspan="">
87<paragraph role="tablecontent" id="par_idN1066A" xml-lang="en-US" l10n="NEW">y</paragraph>
88</tablecell>
89<tablecell colspan="" rowspan="">
90<paragraph role="tablecontent" id="par_idN10670" xml-lang="en-US" l10n="NEW">Day of year</paragraph>
91</tablecell>
92</tablerow>
93<tablerow>
94<tablecell colspan="" rowspan="">
95<paragraph role="tablecontent" id="par_idN10677" xml-lang="en-US" l10n="NEW">w</paragraph>
96</tablecell>
97<tablecell colspan="" rowspan="">
98<paragraph role="tablecontent" id="par_idN1067D" xml-lang="en-US" l10n="NEW">Weekday</paragraph>
99</tablecell>
100</tablerow>
101<tablerow>
102<tablecell colspan="" rowspan="">
103<paragraph role="tablecontent" id="par_idN10684" xml-lang="en-US" l10n="NEW">ww</paragraph>
104</tablecell>
105<tablecell colspan="" rowspan="">
106<paragraph role="tablecontent" id="par_idN1068A" xml-lang="en-US" l10n="NEW">Week of year</paragraph>
107</tablecell>
108</tablerow>
109<tablerow>
110<tablecell colspan="" rowspan="">
111<paragraph role="tablecontent" id="par_idN10691" xml-lang="en-US" l10n="NEW">d</paragraph>
112</tablecell>
113<tablecell colspan="" rowspan="">
114<paragraph role="tablecontent" id="par_idN10697" xml-lang="en-US" l10n="NEW">Day</paragraph>
115</tablecell>
116</tablerow>
117<tablerow>
118<tablecell colspan="" rowspan="">
119<paragraph role="tablecontent" id="par_idN1069E" xml-lang="en-US" l10n="NEW">h</paragraph>
120</tablecell>
121<tablecell colspan="" rowspan="">
122<paragraph role="tablecontent" id="par_idN106A4" xml-lang="en-US" l10n="NEW">Hour</paragraph>
123</tablecell>
124</tablerow>
125<tablerow>
126<tablecell colspan="" rowspan="">
127<paragraph role="tablecontent" id="par_idN106AB" xml-lang="en-US" l10n="NEW">n</paragraph>
128</tablecell>
129<tablecell colspan="" rowspan="">
130<paragraph role="tablecontent" id="par_idN106B1" xml-lang="en-US" l10n="NEW">Minute</paragraph>
131</tablecell>
132</tablerow>
133<tablerow>
134<tablecell colspan="" rowspan="">
135<paragraph role="tablecontent" id="par_idN106B8" xml-lang="en-US" l10n="NEW">s</paragraph>
136</tablecell>
137<tablecell colspan="" rowspan="">
138<paragraph role="tablecontent" id="par_idN106BE" xml-lang="en-US" l10n="NEW">Second</paragraph>
139</tablecell>
140</tablerow>
141</table>
142
143</section>
144<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>
145<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>
146<paragraph role="heading" id="par_idN106C7" xml-lang="en-US" level="2" l10n="NEW">Example:</paragraph>
147<paragraph role="code" id="par_idN106CB" xml-lang="en-US" l10n="NEW">Sub example_dateadd</paragraph>
148<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>
149<paragraph role="code" id="par_idN106D1" xml-lang="en-US" l10n="NEW">End Sub</paragraph>
150</body>
151</helpdocument>
152