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