TIMENOW

TIMENOW([hour] [,minute] [,seconds] [,time_format])
Returns the current time as a string (in the format "hh:mm:ss")

hour(Optional) The hour component, between 0 and 23.
minute(Optional) The minute component, between 0 and 59.
seconds(Optional) The second component, between 0 and 59.
time_format(Optional) The time format

REMARKS
* You can use the built-in TIME function to return the time as a decimal given an hour, minute, second.
* This function is never volatile and can only be updated manually
* You can use the shortcut key (Ctrl + ;) to quickly insert the date.
* You can use the shortcut key (Ctrl + Shift + ;) to quickly insert the time in "hh:mm" format.

 A
1equals =JS.TIMENOW()

Public Function TIMENOW( _ 
         ByVal iHour As Integer, _
         ByVal iMinutes As Integer, _
Optional ByVal iSeconds As Integer = 0) _
         As String

Dim shour As String
Dim sminutes As String
Dim sseconds As String

   shour = iHour
   If Len(shour) = 1 Then shour = "0" & shour

   sminutes = iMinutes
   If Len(sminutes) = 1 Then sminutes = "0" & sminutes

   If (iSeconds = 0) Then
      sseconds = "00"
   Else
      sseconds = iSeconds
      If Len(sseconds) = 1 Then sseconds = "0" & sseconds
   End If
      
   TIMENOW = shour & ":" & sminutes & ":" & sseconds
End Function

© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext