Second - VBScript
Second
Overview
VB Script’s Second
command retrieves the second component of a time value. It is primarily used to extract the seconds from a time string or Date
object.
Syntax
Second(timeStringOrDateObject)
timeStringOrDateObject
: The time string in the format"hh:mm:ss"
or aDate
object from which to extract the seconds.
Options/Flags
None
Examples
> Second("12:45:23")
23
> Second(CDate("17:18:19"))
19
Common Issues
- Invalid time format: Ensure the time string is in the correct format
"hh:mm:ss"
. - Null input: If
timeStringOrDateObject
is not provided or isNull
, the result will beNull
.
Integration
Second
is often used in combination with other time-related commands, such as Hour
and Minute
. It can be used to extract specific time components for various purposes, such as time calculations or displaying specific parts of a timestamp.
Related Commands
- Date: Retrieves the current date and time.
- Hour: Retrieves the hour component of a time value.
- Minute: Retrieves the minute component of a time value.