Function Description: Date/Time Functions
Function Description: Date/Time Functions
This page contains all the built-in VBScript functions. The page is divided into following sections:
Date/Time Functions
Function Description
CDate Converts a valid date and time expression to the variant of subtype
Date
DateAdd Returns a date to which a specified time interval has been added
DateSerial Returns the date for a specified year, month, and day
Day Returns a number that represents the day of the month (between 1
and 31, inclusive)
Hour Returns a number that represents the hour of the day (between 0
and 23, inclusive)
Minute Returns a number that represents the minute of the hour (between 0
and 59, inclusive)
Month Returns a number that represents the month of the year (between 1
and 12, inclusive)
Second Returns a number that represents the second of the minute (between
0 and 59, inclusive)
TimeSerial Returns the time for a specific hour, minute, and second
Weekday Returns a number that represents the day of the week (between 1
and 7, inclusive)
Top
Conversion Functions
Function Description
CDate Converts a valid date and time expression to the variant of subtype
Date
Top
Format Functions
Function Description
FormatCurrency Returns an expression formatted as a currency value
Top
Math Functions
Function Description
Top
Array Functions
Function Description
UBound Returns the largest subscript for the indicated dimension of an array
Top
String Functions
Function Description
InStr Returns the position of the first occurrence of one string within
another. The search begins at the first character of the string
InStrRev Returns the position of the first occurrence of one string within
another. The search begins at the last character of the string
Trim Removes spaces on both the left and the right side of a string
StrComp Compares two strings and returns a value that represents the result
of the comparison
Top
Other Functions
Function Description
InputBox Displays a dialog box, where the user can write some input and/or
click on a button, and returns the contents
MsgBox Displays a message box, waits for the user to click a button, and
returns a value that indicates which button the user clicked
ScriptEngineMajorVersion Returns the major version number of the scripting engine in use
ScriptEngineMinorVersion Returns the minor version number of the scripting engine in use
VBScript Keywords
Keyword Description
Empty Used to indicate an uninitialized variable value. A variable value is uninitialized when
it is first created and no value is assigned to it, or when a variable value is explicitly
set to empty.
Example:
Dim x 'the variable x is uninitialized!
x="ff" 'the variable x is NOT uninitialized anymore
x=Empty 'the variable x is uninitialized!
Note: If you compare a value to Nothing, you will not get the right result! Example:
If (myObject = Nothing) 'always false!
Null Used to indicate that a variable contains no valid data.
One way to think of Null is that someone has explicitly set the value to "invalid",
unlike Empty where the value is "not set".