TIMESERIAL(hour, minute, second)

Returns the time for a specific hour, minute and second (Date).

hourThe number between 0 and 23 representing the hour (Integer).
minuteThe number between 0 and 59 representing the minute (Integer).
secondThe number between 0 and 59 representing the second (Integer).

* This function can accept values outside the normal range.
* If you pass in 90 seconds it will return a time in the next minute and 30 seconds.
* You can also specify relative times for each argument using any numeric expression that represents some number of hours, minutes, or seconds before or after a certain time.
* The following example uses expressions instead of absolute time numbers.
* This function returns a time for 15 minutes before (-15) six hours before noon (12 - 6), or 5:45:00 A.M.
* If any argument is outside -32,768 to 32,767 then an error occurs. Type Mismatch.
* You can use the TIMEVALUE function to return the time given a string representation.
* The equivalent .NET function is Microsoft.VisualBasic.DateAndTime.TimeSerial
* For the Microsoft documentation refer to learn.microsoft.com

Debug.Print TimeSerial(12 - 6, -15, 0)  '= 05:45:00  
Debug.Print TimeSerial(12,30,0) '= 12:30:00
Debug.Print TimeSerial(10,90,0) '= 11:30 '90 minutes added

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top