Examples: Hour function

' Construct a message that displays the current time and 
' the number of hours, minutes, and seconds remaining
' in the day.
Dim timeFrag As String, hoursFrag As String
Dim minutesFrag As String, secondsFrag As String
Dim crlf As String, message As String
timeFrag$ = Format(Time, "h:mm:ss AM/PM")
hoursFrag$ = Str(23 - Hour(Time))
minutesFrag$ = Str(59 - Minute(Time))
secondsFrag$ = Str(60 - Second(Time))
crlf$ = Chr(13) & Chr(10)      ' Carriage return/line feed
message$ = "Current time: " & timeFrag$ & ". " & crlf$ _
   & "Time remaining in the day: " _ 
   & hoursFrag$ & " hours, " _
   & minutesFrag$ & " minutes, and " _
   & secondsFrag$ & " seconds."
MessageBox(message$)