Minute - VBScript
Overview
The Minute command in VB Script extracts the minute component from a specified date value. It is primarily used to obtain the current minute or work with date and time calculations.
Syntax
Minute(date)
Parameters:
date (Required)
: A Date or Variant containing a date value.
Options/Flags
None.
Examples
Simple Example:
Dim now = Date
Debug.Print Minute(now) ' Prints the current minute
Complex Example:
Dim startDate = "2023-05-15 14:35:42"
Dim timedelta = 30
Dim newDate = DateAdd("n", timedelta, startDate)
Debug.Print Minute(newDate) ' Prints the minute component of the new date
Common Issues
- If the
date
parameter is not valid or cannot be parsed, an error is raised. - To extract the minute component from a string, convert it to a Date value first.
Integration
VB Script’s Minute command can be combined with other date and time functions, such as Hour, Second, and DateAdd, to perform advanced date and time operations.
Related Commands
- Hour: Extracts the hour component from a date.
- Second: Extracts the second component from a date.
- DateAdd: Adds a specified time interval to a date.