1cdf0e10cSrcweir<?xml version="1.0" encoding="UTF-8"?> 2cdf0e10cSrcweir 3cdf0e10cSrcweir 4*82a1df74SAndrew Rist<!--*********************************************************** 5cdf0e10cSrcweir * 6*82a1df74SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 7*82a1df74SAndrew Rist * or more contributor license agreements. See the NOTICE file 8*82a1df74SAndrew Rist * distributed with this work for additional information 9*82a1df74SAndrew Rist * regarding copyright ownership. The ASF licenses this file 10*82a1df74SAndrew Rist * to you under the Apache License, Version 2.0 (the 11*82a1df74SAndrew Rist * "License"); you may not use this file except in compliance 12*82a1df74SAndrew Rist * with the License. You may obtain a copy of the License at 13cdf0e10cSrcweir * 14*82a1df74SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 15cdf0e10cSrcweir * 16*82a1df74SAndrew Rist * Unless required by applicable law or agreed to in writing, 17*82a1df74SAndrew Rist * software distributed under the License is distributed on an 18*82a1df74SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 19*82a1df74SAndrew Rist * KIND, either express or implied. See the License for the 20*82a1df74SAndrew Rist * specific language governing permissions and limitations 21*82a1df74SAndrew Rist * under the License. 22cdf0e10cSrcweir * 23*82a1df74SAndrew Rist ***********************************************************--> 24*82a1df74SAndrew Rist 25*82a1df74SAndrew Rist 26cdf0e10cSrcweir 27cdf0e10cSrcweir<helpdocument version="1.0"> 28cdf0e10cSrcweir<meta> 29cdf0e10cSrcweir<topic id="textsbasicshared03030120xhp" indexer="include" status="PUBLISH"> 30cdf0e10cSrcweir<title id="tit" xml-lang="en-US">DateDiff Function [Runtime]</title> 31cdf0e10cSrcweir<filename>/text/sbasic/shared/03030120.xhp</filename> 32cdf0e10cSrcweir</topic> 33cdf0e10cSrcweir<history> 34cdf0e10cSrcweir<created date="2005-04-25T13:20:42">DateDiff</created> 35cdf0e10cSrcweir<lastedited date="2005-04-26T10:55:34">checked</lastedited> 36cdf0e10cSrcweir</history> 37cdf0e10cSrcweir</meta> 38cdf0e10cSrcweir<body> 39cdf0e10cSrcweir<section id="datediff"> 40cdf0e10cSrcweir<bookmark xml-lang="en-US" branch="index" id="bm_id6134830"><bookmark_value>DateDiff function</bookmark_value> 41cdf0e10cSrcweir</bookmark> 42cdf0e10cSrcweir<paragraph role="heading" id="par_idN10542" xml-lang="en-US" level="1" l10n="NEW"><link href="text/sbasic/shared/03030120.xhp">DateDiff Function [Runtime]</link></paragraph> 43cdf0e10cSrcweir<paragraph role="paragraph" id="par_idN10546" xml-lang="en-US" l10n="NEW">Returns the number of date intervals between two given date values.</paragraph> 44cdf0e10cSrcweir</section> 45cdf0e10cSrcweir<paragraph role="heading" id="par_idN10549" xml-lang="en-US" level="2" l10n="NEW">Syntax:</paragraph> 46cdf0e10cSrcweir<paragraph role="paragraph" id="par_idN10648" xml-lang="en-US" l10n="NEW">DateDiff (Add, Date1, Date2 [, Week_start [, Year_start]])</paragraph> 47cdf0e10cSrcweir<paragraph role="heading" id="par_idN1064B" xml-lang="en-US" level="2" l10n="NEW">Return value:</paragraph> 48cdf0e10cSrcweir<paragraph role="paragraph" id="par_idN1064F" xml-lang="en-US" l10n="NEW">A number.</paragraph> 49cdf0e10cSrcweir<paragraph role="heading" id="par_idN10652" xml-lang="en-US" level="2" l10n="NEW">Parameters:</paragraph> 50cdf0e10cSrcweir<paragraph role="paragraph" id="par_idN10656" xml-lang="en-US" l10n="NEW"> 51cdf0e10cSrcweir<emph>Add</emph> - A string expression from the following table, specifying the date interval.</paragraph> 52cdf0e10cSrcweir<embed href="text/sbasic/shared/03030110.xhp#datetable"/> 53cdf0e10cSrcweir<paragraph role="paragraph" id="par_idN10664" xml-lang="en-US" l10n="NEW"> 54cdf0e10cSrcweir<emph>Date1, Date2</emph> - The two date values to be compared.</paragraph> 55cdf0e10cSrcweir<section id="weekyear"> 56cdf0e10cSrcweir<paragraph role="paragraph" id="par_idN1066A" xml-lang="en-US" l10n="NEW"> 57cdf0e10cSrcweir<emph>Week_start</emph> - An optional parameter that specifies the starting day of a week. </paragraph> 58cdf0e10cSrcweir<table id="tbl_id8356883"> 59cdf0e10cSrcweir<tablerow> 60cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 61cdf0e10cSrcweir<paragraph role="tablehead" id="par_idN1067A" xml-lang="en-US" l10n="NEW">Week_start value</paragraph> 62cdf0e10cSrcweir</tablecell> 63cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 64cdf0e10cSrcweir<paragraph role="tablehead" id="par_idN10680" xml-lang="en-US" l10n="NEW">Explanation</paragraph> 65cdf0e10cSrcweir</tablecell> 66cdf0e10cSrcweir</tablerow> 67cdf0e10cSrcweir<tablerow> 68cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 69cdf0e10cSrcweir<paragraph role="tablecontent" id="par_idN10687" xml-lang="en-US" l10n="NEW">0</paragraph> 70cdf0e10cSrcweir</tablecell> 71cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 72cdf0e10cSrcweir<paragraph role="tablecontent" id="par_idN1068D" xml-lang="en-US" l10n="NEW">Use system default value</paragraph> 73cdf0e10cSrcweir</tablecell> 74cdf0e10cSrcweir</tablerow> 75cdf0e10cSrcweir<tablerow> 76cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 77cdf0e10cSrcweir<paragraph role="tablecontent" id="par_idN10694" xml-lang="en-US" l10n="NEW">1</paragraph> 78cdf0e10cSrcweir</tablecell> 79cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 80cdf0e10cSrcweir<paragraph role="tablecontent" id="par_idN1069A" xml-lang="en-US" l10n="NEW">Sunday (default)</paragraph> 81cdf0e10cSrcweir</tablecell> 82cdf0e10cSrcweir</tablerow> 83cdf0e10cSrcweir<tablerow> 84cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 85cdf0e10cSrcweir<paragraph role="tablecontent" id="par_idN106A1" xml-lang="en-US" l10n="NEW">2</paragraph> 86cdf0e10cSrcweir</tablecell> 87cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 88cdf0e10cSrcweir<paragraph role="tablecontent" id="par_idN106A7" xml-lang="en-US" l10n="NEW">Monday</paragraph> 89cdf0e10cSrcweir</tablecell> 90cdf0e10cSrcweir</tablerow> 91cdf0e10cSrcweir<tablerow> 92cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 93cdf0e10cSrcweir<paragraph role="tablecontent" id="par_idN106AE" xml-lang="en-US" l10n="NEW">3</paragraph> 94cdf0e10cSrcweir</tablecell> 95cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 96cdf0e10cSrcweir<paragraph role="tablecontent" id="par_idN106B4" xml-lang="en-US" l10n="NEW">Tuesday</paragraph> 97cdf0e10cSrcweir</tablecell> 98cdf0e10cSrcweir</tablerow> 99cdf0e10cSrcweir<tablerow> 100cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 101cdf0e10cSrcweir<paragraph role="tablecontent" id="par_idN106BB" xml-lang="en-US" l10n="NEW">4</paragraph> 102cdf0e10cSrcweir</tablecell> 103cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 104cdf0e10cSrcweir<paragraph role="tablecontent" id="par_idN106C1" xml-lang="en-US" l10n="NEW">Wednesday</paragraph> 105cdf0e10cSrcweir</tablecell> 106cdf0e10cSrcweir</tablerow> 107cdf0e10cSrcweir<tablerow> 108cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 109cdf0e10cSrcweir<paragraph role="tablecontent" id="par_idN106C8" xml-lang="en-US" l10n="NEW">5</paragraph> 110cdf0e10cSrcweir</tablecell> 111cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 112cdf0e10cSrcweir<paragraph role="tablecontent" id="par_idN106CE" xml-lang="en-US" l10n="NEW">Thursday</paragraph> 113cdf0e10cSrcweir</tablecell> 114cdf0e10cSrcweir</tablerow> 115cdf0e10cSrcweir<tablerow> 116cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 117cdf0e10cSrcweir<paragraph role="tablecontent" id="par_idN106D5" xml-lang="en-US" l10n="NEW">6</paragraph> 118cdf0e10cSrcweir</tablecell> 119cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 120cdf0e10cSrcweir<paragraph role="tablecontent" id="par_idN106DB" xml-lang="en-US" l10n="NEW">Friday</paragraph> 121cdf0e10cSrcweir</tablecell> 122cdf0e10cSrcweir</tablerow> 123cdf0e10cSrcweir<tablerow> 124cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 125cdf0e10cSrcweir<paragraph role="tablecontent" id="par_idN106E2" xml-lang="en-US" l10n="NEW">7</paragraph> 126cdf0e10cSrcweir</tablecell> 127cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 128cdf0e10cSrcweir<paragraph role="tablecontent" id="par_idN106E8" xml-lang="en-US" l10n="NEW">Saturday</paragraph> 129cdf0e10cSrcweir</tablecell> 130cdf0e10cSrcweir</tablerow> 131cdf0e10cSrcweir</table> 132cdf0e10cSrcweir 133cdf0e10cSrcweir<paragraph role="paragraph" id="par_idN106EB" xml-lang="en-US" l10n="NEW"> 134cdf0e10cSrcweir<emph>Year_start</emph> - An optional parameter that specifies the starting week of a year. </paragraph> 135cdf0e10cSrcweir<table id="tbl_id1173436"> 136cdf0e10cSrcweir<tablerow> 137cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 138cdf0e10cSrcweir<paragraph role="tablehead" id="par_idN106FB" xml-lang="en-US" l10n="NEW">Year_start value</paragraph> 139cdf0e10cSrcweir</tablecell> 140cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 141cdf0e10cSrcweir<paragraph role="tablehead" id="par_idN10701" xml-lang="en-US" l10n="NEW">Explanation</paragraph> 142cdf0e10cSrcweir</tablecell> 143cdf0e10cSrcweir</tablerow> 144cdf0e10cSrcweir<tablerow> 145cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 146cdf0e10cSrcweir<paragraph role="tablecontent" id="par_idN10708" xml-lang="en-US" l10n="NEW">0</paragraph> 147cdf0e10cSrcweir</tablecell> 148cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 149cdf0e10cSrcweir<paragraph role="tablecontent" id="par_idN1070E" xml-lang="en-US" l10n="NEW">Use system default value</paragraph> 150cdf0e10cSrcweir</tablecell> 151cdf0e10cSrcweir</tablerow> 152cdf0e10cSrcweir<tablerow> 153cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 154cdf0e10cSrcweir<paragraph role="tablecontent" id="par_idN10715" xml-lang="en-US" l10n="NEW">1</paragraph> 155cdf0e10cSrcweir</tablecell> 156cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 157cdf0e10cSrcweir<paragraph role="tablecontent" id="par_idN1071B" xml-lang="en-US" l10n="NEW">Week 1 is the week with January, 1st (default)</paragraph> 158cdf0e10cSrcweir</tablecell> 159cdf0e10cSrcweir</tablerow> 160cdf0e10cSrcweir<tablerow> 161cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 162cdf0e10cSrcweir<paragraph role="tablecontent" id="par_idN10722" xml-lang="en-US" l10n="NEW">2</paragraph> 163cdf0e10cSrcweir</tablecell> 164cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 165cdf0e10cSrcweir<paragraph role="tablecontent" id="par_idN10728" xml-lang="en-US" l10n="NEW">Week 1 is the first week containing four or more days of that year</paragraph> 166cdf0e10cSrcweir</tablecell> 167cdf0e10cSrcweir</tablerow> 168cdf0e10cSrcweir<tablerow> 169cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 170cdf0e10cSrcweir<paragraph role="tablecontent" id="par_idN1072F" xml-lang="en-US" l10n="NEW">3</paragraph> 171cdf0e10cSrcweir</tablecell> 172cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 173cdf0e10cSrcweir<paragraph role="tablecontent" id="par_idN10735" xml-lang="en-US" l10n="NEW">Week 1 is the first week containing only days of the new year</paragraph> 174cdf0e10cSrcweir</tablecell> 175cdf0e10cSrcweir</tablerow> 176cdf0e10cSrcweir</table> 177cdf0e10cSrcweir 178cdf0e10cSrcweir</section> 179cdf0e10cSrcweir<paragraph role="heading" id="par_idN10738" xml-lang="en-US" level="2" l10n="NEW">Example:</paragraph> 180cdf0e10cSrcweir<paragraph role="code" id="par_idN1073C" xml-lang="en-US" l10n="NEW">Sub example_datediff</paragraph> 181cdf0e10cSrcweir<paragraph role="code" id="par_idN1073F" xml-lang="en-US" l10n="NEW">msgbox DateDiff("d", "1/1/2005", "12/31/2005")</paragraph> 182cdf0e10cSrcweir<paragraph role="code" id="par_idN10742" xml-lang="en-US" l10n="NEW">End Sub</paragraph> 183cdf0e10cSrcweir</body> 184cdf0e10cSrcweir</helpdocument> 185