MS Access: Second Function
This MSAccess tutorial explains how to use the Access Second function with syntax and examples.
Description
The Microsoft Access Second function returns the second of the minute (a number from 0 to 59) given a time value.
Syntax
The syntax for the Second function in MS Access is:
Second ( time_value )
Parameters or Arguments
- time_value
- A valid time.
Returns
The Second function returns a numeric value between 0 and 59.
Applies To
The Second function can be used in the following versions of Microsoft Access:
- Access 2019, Access 2016, Access 2013, Access 2010, Access 2007, Access 2003, Access XP, Access 2000
Example
Let's look at how to use the Second function in MS Access:
Second (#10:42:58 PM#) Result: 58 Second (#10:14:13 AM#) Result: 13 Second (#22/11/2003 10:01:04 PM#) Result: 4
Example in VBA Code
The Second function can be used in VBA code in Microsoft Access.
For example:
Dim LSecond As Integer LSecond = Second (#10:13:58 AM#)
In this example, the variable called LSecond would now contain the value of 58.
Example in SQL/Queries
You can also use the Second function in a query in Microsoft Access.
For example:
In this query, we have used the Second function as follows:
Expr1: Second(#10:42:58 PM#)
and
Expr2: Second([CategoryDate])
The first Second function will extract the second value from the time 10:42:58 PM and display the results in a column called Expr1. You can replace Expr1 with a column name that is more meaningful.
For example:
SecondValue: Second(#10:42:58 PM#)
The results would now be displayed in a column called SecondValue.
The other Second function will extract the second value from the CategoryDate field and return the results in a column called Expr2.
Advertisements