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