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>VBScript</strong> <strong>Reference</strong> <strong>Manual</strong> <strong>InduSoft</strong> <strong>Web</strong> <strong>Studio</strong><br />

Date<br />

Description Returns a Variant of subtype Date indicating the current system date.<br />

Usage dateVal = Date<br />

Arguments none<br />

Return Returns a Variant subtype Date<br />

Remarks The locale setting can be specified to use the dash “-“ or the <strong>for</strong>ward slash “/” as a separator<br />

See Also Now, Time<br />

Example Dim Mydate<br />

MyDate = Date ‘ Mydate contains the current system date<br />

MsgBox Date<br />

DateAdd<br />

Description Returns a date to which a specified time interval has been added or subtracted<br />

Usage dateVal = DateAdd(interval, number, date)<br />

Arguments interval<br />

Required. String expression that is the interval you want to add. .<br />

number<br />

Required. Numeric expression that is the number of interval you want to add. The numeric<br />

expression can either be positive, <strong>for</strong> dates in the future, or negative, <strong>for</strong> dates in the past.<br />

date<br />

Required. Variant or Date literal representing the date to which interval is added<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 />

Return A Date value<br />

Remarks You can use the DateAdd function to add or subtract a specified time interval from a date. For<br />

example, you can use DateAdd to calculate a date 30 days from today or a time 45 minutes from<br />

now. To add days to date, you can use Day of Year ("y"), Day ("d"), or Weekday ("w").<br />

The DateAdd function won't return an invalid date. If the calculated date would precede the year<br />

100, an error occurs. If number isn't a Long value, it is rounded to the nearest whole number<br />

be<strong>for</strong>e being evaluated.<br />

DateAdd is internationally aware, meaning the return value is based on the locale setting on the<br />

local machine. Included in the locale settings are the appropriate date and time separators, the<br />

dates in the correct order of day, month and year.<br />

See Also DateDiff, DatePart<br />

Example The following example adds one month to January 31: In this case, DateAdd returns 28-Feb-95,<br />

not 31-Feb-95. If date is 31-Jan-96, it returns 29-Feb-96 because 1996 is a leap year.<br />

NewDate = DateAdd("m", 1, "31-Jan-95")<br />

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

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

Saved successfully!

Ooh no, something went wrong!