Showing posts with label vb script. Show all posts
Showing posts with label vb script. Show all posts

VB Script Date and Time Functions



Function
Description
Sample Arguments
CDate(date)    
Returns a date representation of date.
"jan 19, 1926"
Date
Returns the date set on the server running IIS.

DateAdd(interval,number,datetime)
Adds number years to datetime.
"yyyy",10,Now
Adds number quarters to datetime.
"q",10,Now
Adds number months to datetime.
"m",10,Now
Adds number days to datetime.
"d",10,Now
Adds number weeks to datetime.
"ww",10,Now
Adds number hours to datetime.
"h",10,Now
Adds number seconds to datetime.
"s",10,Now
DateDiff(interval,startdate,enddate)
Returns number of years between startdate and enddate.
"yyyy","12/9/1973",Now
Returns number of quarters between startdate and enddate.
"q","3/9/1963",Now
Returns number of months between startdate and enddate.
"m","3/9/1963",Now
Returns number of days between startdate and enddate.
"d","3/9/1963",Now
Returns number of weeks between startdate and enddate.
"ww","3/9/1963",Now
Returns number of hours between startdate and enddate.
"h","3/9/1963",Now
Returns number of seconds between startdate and enddate.
"s","3/9/1963",Now
DatePart(interval,date)
Returns the year of date.
"yyyy",Now
Returns the quarter of date.
"q",Now
Returns the month of date.
"m",Now
Returns the day of year of date.
"y",Now
Returns the day of month of date.
"d",Now
Returns the weekday of date.
"w",Now
Returns the week of year of date.
"ww",Now
Returns the hour of date.
"h",Now
Returns the second of date.
"s",Now
DateSerial(year,month,day)
Returns a date representation of selected year, month, and day.
1975,08,25
DateValue(date)
Returns a date representation of date.
"Dec 29, 1939"
Day(date)
Returns the day of the month of date.
Date
FormatDateTime(datetime[,format])
Returns a date/time representation of datetime with optional format.
Now
Now,vbLongDate
Now,vbShortDate
Now,vbLongTime
Now,vbShortTime
Hour(time)
Returns the hour of the day of time.
Time
IsDate(arg)
Returns True if arg is a valid date or False if arg is not a valid date.
"Mar 15, 1947"
"Mar 35, 1947"
Minute(time)
Returns the minute of the hour of time.
Time
Month(date)
Returns the month of the year of date.
Date
MonthName(month,[abbreviate])
Returns the name of month number month.
MonthName(3)
Returns abbreviation of month number month.
MonthName(1,True)
Now
Returns the date and time set on the server running IIS.

Second(time)
Returns the second of the minute time.
Time
Time
Returns the time set on the server running IIS.

TimeSerial(hour,minute,second)
Returns a time representation of selected hour, minute, and second.
08,44,41
TimeValue(time)
Returns a time representation of time.
"12:29:39"
Weekday(date)
Returns the day of the week of date.
Date
WeekdayName(date,[abbreviate])
Returns the name of weekday number weekday.
WeekdayName(5)
Returns abbreviation of weekday number weekday.
WeekdayName(1,True)
Year(date)
Returns the year of date.
Date

Variables in VB Script

VB Script Variables: Variable is nothing but we are allocating some space to the particular variable to store some information. In variables we are storing the information to that value.
A=10
Here A is Variable Name

In VB Script we have two types of Variables.

1) User defined Variables
2) Pre-defined Variables.

Variables: 
For example:  a= 1o, dim =10
                       Here a=variable name
                                 10=we are assigning one value to the particular variable.

1) User defined Variables: In user defined variable user will define the variable name.
For example:  a= 1o
                       Here a=variable name
                                 10=we are assigning one value to the particular variable.
 2) Pre-defined Variable: per-defined variable means Vb Script having default variables those variables are called Pre-defined.

For example:  dim= 1o
                       Here a=variable name
                       10=we are assigning one value to the particular variable.

In this example dim is a per-defined variable. We can’t use that variable as a user defined variable.