DatePart Function

Abs Function,Array Function,Asc Function,Atn Function,CBool Function,CByte Function,CCur Function,CDate Function,CDbl Function,Chr Function,CInt Function,CLng Function,Cos Function,CreateObject Function,CSng Function,CStr Function,Date Function,DateAdd Function,DateDiff Function,DatePart Function,DateSerial Function,DateValue Function,Day Function,Eval Function,Exp Function,Filter Function,Fix Function,FormatCurrency Function,FormatDateTime Function,FormatNumber Function,FormatPercent Function,GetLocale Function,GetObject Function,GetRef Function,Hex Function,Hour Function,InputBox Function,InStr Function,InStrRev Function,Int Function,IsArray Function,IsDate Function,IsEmpty Function,IsNull Function,IsNumeric Function,IsObject Function,Join Function,LBound Function,LCase Function,Left Function,Len Function,LoadPicture Function,Log Function,LTrim Function,Mid Function,Minute Function,Month Function,MonthName Function,MsgBox Function,Now Function,Oct Function,Replace Function,RGB Function,Right Function,Rnd Function,Round Function,RTrim Function,ScriptEngine Function,ScriptEngineBuildVersion Function,ScriptEngineMajorVersion Function,ScriptEngineMinorVersion Function,Second Function,Sgn Function,Sin Function,Space Function,Split Function,Sqr Function,StrComp Function,String Function,StrReverse Function,Tan Function,Time Function,Timer Function,TimeSerial Function,TimeValue Function,Trim Function,TypeName Function,UBound Function,UCase Function,VarType Function,Weekday Function,WeekdayName Function,Year Function Home home | Other Resources other resources | Advertise with us advertise | Link to us link to us | Contact us contact | Bookmark Us!
Google
 
Where can I find good Windows Web Hosting to host my VBScript Site?
You can find good Windows Hosting which support VBScript, ASP, ASP.Net,VisualStudio.Net and MSSQL at a very reasonable low monthly fee at EasyCGI.com and DiscountASP.Net

DatePart Function

Returns the specified part of a given date.

DatePart(interval, date[, firstdayofweek[, firstweekofyear]])

Arguments

interval

Required. String expression that is the interval of time you want to return. See Settings section for values.

date

Required. Date expression you want to evaluate.

firstdayof week

Optional. Constant that specifies the day of the week. If not specified, Sunday is assumed. See Settings section for values.

firstweekofyear

Optional. Constant that specifies the first week of the year. If not specified, the first week is assumed to be the week in which January 1 occurs. See Settings section for values.

Settings

The interval argument can have the following values:

SettingDescription
yyyyYear
qQuarter
mMonth
yDay of year
dDay
wWeekday
wwWeek of year
hHour
nMinute
sSecond

The firstdayofweek argument can have the following values:

ConstantValueDescription
vbUseSystem0Use National Language Support (NLS) API setting.
vbSunday1Sunday (default)
vbMonday2Monday
vbTuesday3Tuesday
vbWednesday4Wednesday
vbThursday5Thursday
vbFriday6Friday
vbSaturday7Saturday

The firstweekofyear argument can have the following values:

ConstantValueDescription
vbUseSystem0Use National Language Support (NLS) API setting.
vbFirstJan11Start with the week in which January 1 occurs (default).
vbFirstFourDays2Start with the week that has at least four days in the new year.
vbFirstFullWeek3Start with the first full weekof the new year.

Remarks

You can use the DatePart function to evaluate a date and return a specific interval of time. For example, you might use DatePart 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.

This example takes a date and, using the DatePart function, displays the quarter of the year in which it occurs.

Function GetQuarter(TheDate)
   GetQuarter = DatePart("q", TheDate)
End Function

VBScriptOnline.com - Abs Function,Array Function,Asc Function,Atn Function,CBool Function,CByte Function,CCur Function,CDate Function,CDbl Function,Chr Function,CInt Function,CLng Function,Cos Function,CreateObject Function,CSng Function,CStr Function,Date Function,DateAdd Function,DateDiff Function,DatePart Function,DateSerial Function,DateValue Function,Day Function,Eval Function,Exp Function,Filter Function,Fix Function,FormatCurrency Function,FormatDateTime Function,FormatNumber Function,FormatPercent Function,GetLocale Function,GetObject Function,GetRef Function,Hex Function,Hour Function,InputBox Function,InStr Function,InStrRev Function,Int Function,IsArray Function,IsDate Function,IsEmpty Function,IsNull Function,IsNumeric Function,IsObject Function,Join Function,LBound Function,LCase Function,Left Function,Len Function,LoadPicture Function,Log Function,LTrim Function,Mid Function,Minute Function,Month Function,MonthName Function,MsgBox Function,Now Function,Oct Function,Replace Function,RGB Function,Right Function,Rnd Function,Round Function,RTrim Function,ScriptEngine Function,ScriptEngineBuildVersion Function,ScriptEngineMajorVersion Function,ScriptEngineMinorVersion Function,Second Function,Sgn Function,Sin Function,Space Function,Split Function,Sqr Function,StrComp Function,String Function,StrReverse Function,Tan Function,Time Function,Timer Function,TimeSerial Function,TimeValue Function,Trim Function,TypeName Function,UBound Function,UCase Function,VarType Function,Weekday Function,WeekdayName Function,Year Function