Promotic
WikipediaLinkedInYoutubeTwitterFacebook

DatePart - function of language VBScript

Description:
Returns the specified part of a given date.
Syntax:
DatePart(interval As String, date As Date, [firstdayofweek As Integer], [firstweekofyear As Integer]) As Date
Calling:
d = DatePart(interval, date[, firstdayofweek[, 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 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 9.0.0 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