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
|
Showing posts with label vb script basics. Show all posts
Showing posts with label vb script basics. Show all posts
VB Script Date and Time Functions
Operators in VB Script
1) Arithmetic operators:
2) Comparison Operators:
Operator
|
Description
|
Example
|
|
+
|
Addition
- Add values on either side of the operator.
If a=10 and B=20 then
|
a + b will give 30
|
|
_
|
Subtraction
- Subtracts right hand operand from left
hand operand
If
a=10 and B=20 then
|
a - b will give -10
|
|
*
|
Multiplication
- Multiplies values on either side of Operator
If
a=10 and B=20 then
|
a * b will give 200
|
|
/
|
Division
- Divides left hand operand by right hand
operand
If
a=10 and B=20 then
|
b/a=2
|
|
%
|
Modulus - Divides left hand operand
by right hand operand and returns
remainder
|
b % a
will give 0
|
|
2) Comparison Operators:
=
|
Checks if the values of two operands
are equal or not, if yes then condition becomes true. If a=10 and B=20 then
|
(A=B) is
not true
|
|
!=
|
Checks if the values of two operands
are equal or
not, if values are not equal then condition becomes true. |
(A! =B)
is true.
|
|
<>
|
Checks if the values of two operands
are equal or
not, if values are not equal then condition becomes true. |
(A<>B)
is true
|
|
>
|
Checks if the value of left operand
is greater than
the value of right operand, if yes then condition becomes true. |
(A > B)
is not true.
|
|
<
|
Checks if the value of left operand
is less than the
value of right operand, if yes then condition becomes true. |
(A < B)
is true.
|
|
>=
|
Checks if the value of left operand
is greater than
or equal to the value of right operand, if yes then condition becomes true. |
(A >=
B) is not true.
|
|
<=
|
Checks if the value of left operand is less
than or equal to the value of right operand, if yes then condition becomes
true.
|
(A <=
B) is true.
|
|
!<
|
Checks if the value of left operand
is not less than
the value of right operand, if yes then condition becomes true. |
(A! <
B) is false.
|
|
!>
|
Checks if the value of left operand
is not greater
than the value of right operand, if yes then condition becomes true. |
(A! >
B) is true.
|
|
Subscribe to:
Posts (Atom)