VBA – Time Serial Function

  • Post author:
  • Post category:VBA
  • Post comments:1 Comment
TimeSerial function

The TimeSerial function returns the time for the specified hour, minute, and second values.

Syntax

TimeSerial(hour,minute,second) 

Parameter Description

  • Hour − A required parameter, which is an integer between 0 and 23 or any numeric expression.
  • Minute − A required parameter, which is an integer between 0 and 59 or any numeric expression.
  • Second − A required parameter, which is an integer between 0 and 59 or any numeric expression.

Example

Add a button and add the following function.

Private Sub Constant_demo_Click()
   msgbox(TimeSerial(20,1,2))
   msgbox(TimeSerial(0,59,59))
   msgbox(TimeSerial(7*2,60/3,15+3))
End Sub

When you execute the above function, it produces the following output.

8:01:02 PM
12:59:59 AM
2:20:18 PM

Previous Page:-Click Here

This Post Has One Comment

Leave a Reply