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 specified, Sunday is assumed. Values see VBScript Date and Time constants.
firstweekofyear[optional] (Integer) Constant that specifies the first week of year. If not specified, the first week is assumed to be the week in which January 1 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, the specified year becomes a permanent part of that date. However, if date is enclosed in quotation marks (" "), and you omit the year, the current year is inserted in your code each time the date expression is evaluated. This makes it possible to write code that can be used in different years.

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