DatePart - function of language VBScript

Returns the specified part of a given date.
DatePart(interval As String, date As Date, [firstdayofweek As Integer], [firstweekofyear As Integer]) As Date
d = DatePart(interval, date[, firstdayofweek[, firstweekofyear]])
interval(String) String expression that is the interval you want to use to calculate the differences between date1 and date2:
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 expression you want to evaluate
firstdayofweek[optional] (Integer) Constant that specifies the day of the week. If not set, then Sunday is assumed. Values see VBScript Date and Time constants.
firstweekofyear[optional] (Integer) Constant that 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.

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 argument 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.

PROMOTIC 8.3.21 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice