18.01.2013 Views

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>InduSoft</strong> <strong>Web</strong> <strong>Studio</strong> <strong>VBScript</strong> <strong>Reference</strong> <strong>Manual</strong><br />

DateDiff<br />

Description Returns the number of intervals between two dates<br />

Usage intVal = DateDiff(interval, date1, date2 [,firstdayofweek[, firstweekofyear]])<br />

Arguments interval<br />

Required. String expression that is the interval you want to use to calculate the differences<br />

between date1 and date2. See Settings section <strong>for</strong> values.<br />

date1, date2<br />

Required. Date expressions. Two dates you want to use in the calculation.<br />

firstdayofweek<br />

Optional. Constant that specifies the day of the week. If not specified, Sunday is assumed.<br />

See Settings section <strong>for</strong> values.<br />

firstweekofyear<br />

Optional. Constant that specifies the first week of the year. If not specified, the first week is<br />

assumed to be the week in which January 1 occurs. See Settings section <strong>for</strong> values.<br />

Settings The interval argument can have the following values:<br />

Setting Description<br />

yyyy Year<br />

q Quarter<br />

m Month<br />

y Day of year<br />

d Day<br />

w Weekday<br />

ww Week of Year<br />

h Hour<br />

n Minute<br />

s Second<br />

The firstdayofweek argument can have the following values:<br />

Constant Value Description<br />

vbUseSystemDayofWeek 0 Use National Language Support (NLS) API setting<br />

<strong>for</strong> different language and locale specific settings<br />

vbSunday 1 Sunday (default)<br />

vbMonday 2 Monday<br />

vbTuesday 3 Tuesday<br />

vbWednesday 4 Wednesday<br />

vbThursday 5 Thursday<br />

vbFriday 6 Friday<br />

vbSaturday 7 Saturday<br />

The firstweekofyear argument can have the following values:<br />

Constant Value Description<br />

vbUseSystem 0 Use National Language Support (NLS) API setting<br />

<strong>for</strong> different language and locale specific settings<br />

vbFirstJan1 1 Start with the week in which Jan 1 occurs (default)<br />

vbFirstFourDays 2 Start with the week that has at least 4 days in the<br />

new year<br />

vbFirstFullWeek 3 Start with the first fill week of the new year<br />

Remarks You can use the DateDiff function to determine how many specified time intervals exist between<br />

two dates. For example, you might use DateDiff to calculate the number of days between two<br />

dates, or the number of weeks between today and the end of the year.<br />

To calculate the number of days between date1 and date2, you can use either Day of year ("y")<br />

or Day ("d"). When interval is Weekday ("w"), DateDiff returns the number of weeks between the<br />

two dates. If date1 falls on a Monday, DateDiff counts the number of Mondays until date2. It<br />

counts date2 but not date1. If interval is Week ("ww"), however, the DateDiff function returns the<br />

number of calendar weeks between the two dates. It counts the number of Sundays between<br />

<strong>InduSoft</strong>, Ltd. 125

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!