MS Access TimeSerial() Function

The TimeSerial() function in MS Access is used to construct a time value from its individual components: hours, minutes, and seconds.



TimeSerial(): Definition and Usage

This function is helpful when you need to create a time value programmatically, rather than entering it directly as a string. It's particularly useful in queries and VBA code within MS Access applications.

Syntax

Syntax

TimeSerial(hour, minute, second)
      

Parameter Values

Parameter Description Valid Range
hour The hour value (0-23). 0 to 23
minute The minute value (0-59). 0 to 59
second The second value (0-59). 0 to 59

Examples

Creating a Time Value

This example creates a time value representing 3:09:20 PM.

Syntax

SELECT TimeSerial(15, 9, 20);
      
Output

15:09:20 (This will be displayed as a time value in MS Access)
      

Using Calculations Within TimeSerial()

You can perform calculations directly within the TimeSerial() function's arguments. This example subtracts values before creating the time value.

Syntax

SELECT TimeSerial(12 - 2, 40 - 5, 20 - 5);
      
Output

10:35:15 (This will be displayed as a time value in MS Access)
      

Technical Details

The TimeSerial() function has been available in MS Access since version 2000.