Promotic

DatePart - function of language VBScript

Description:
Returns the specified part of a given date.
Syntax:
Date DatePart(String interval, Date date, [Integer firstdayofweek], [Integer firstweekofyear])
Parameters:
interval(String) Specifies the part of date that will be returned::
yyyy - year
q - quarter
m - month
y - day of year
d - day
w - day of the week
ww - week of year
h - hour
n - minute
s - second
date(Date) Date to evaluate
firstdayofweek[optional] (Integer) Specifies day of the week.
If not set, then Sunday is assumed. Values see VBScript date and time constants.
firstweekofyear[optional] (Integer) Specifies the first week of year.
If not set, then the first week is assumed to be the week in which 1st January occurs. Values see VBScript date and time constants.
Note:
You can use the function to evaluate a date and return a specific interval of time. For example, you might use function to calculate the day of the week or the current hour. The firstdayofweek parameter affects calculations that use the "w" and "ww" interval symbols.
If date is a date literal, then the specified year becomes a permanent part of that date. However, if date is enclosed in quotation marks (" "), and you omit the year, then the current year is inserted in your script each time the date expression is evaluated. This makes it possible to write script that can be used in different years.
Example:
VBScriptSelect and copy to clipboard

Dim d
d = DatePart("h", date)
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.