Open In App

TimeValue() and TimeSerial() Function in MS Access

Last Updated : 24 Sep, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

1. TimeValue() Function :
In MS Access, the TimeValue() function returns the time based on the given string. In this function, the string will be passed as a parameter and it will return the time based on the string. And the return time hour part will be 0 to 12 and the minute and second part will be 0 to 59.

Syntax :

TimeValue(string)

Parameter Values :

Parameter Description
string It is Required. the string can be in the range (00:00:00) to (23:59:59)

Example-1 :

SELECT TimeValue("18:15:38");

Output :

6:15:38 PM 

Example-2 :

SELECT TimeValue("5:45:18 PM");

Output :

5:45:18 PM 

2. TimeSerial() Function :
In MS Access, the TimeSerial() function returns the time from the specified parts. First part will be the hour, the second part will be minute and the third part will be second. The hour will be in range 0 to 23, minute will be in range 0 to 59 and second will be in range 0 to 59. In this function the hour, minute and second with separated column will be passed and it will return the time.

Syntax :

TimeSerial(hour, minute, second)

Parameter Values :

Parameter Description
hour required. It will be in the range of 0 to 23.
minute required. It will be in the range of 0 to 59.
second required. It will be in the range of 0 to 59.

Example-1 :

SELECT TimeSerial(5, 10, 20);

Output :

5:10:20 AM 

Example-2 :

SELECT TimeSerial(18-4, 49-24, 18-5);

Output :

2:25:13 PM 

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads