Time, Time$ (statements)

Syntax Time[$] = newtime
Description Sets the system time to the time contained in the specified string.
Comments The Time$ statement requires a string variable in one of the following formats:   HH   HH:MM   HH:MM:SS where HH is between 0 and 23, MM is between 0 and 59, and SS is between 0 and 59. The Time statement converts any valid expression to a time, including string and numeric values. Unlike the Time$ statement, Time recognizes many different time formats, including 12-hour times.
Example This example returns the system time and displays it in a dialog box.
Const crlf = Chr$(13) + Chr$(10)
Sub Main()
  oldtime$ = Time
  msg1 = "Time was: " & oldtime$ & crlf
  Time = "10:30:54"
  msg1 = msg1 & "Time set to: " & Time & crlf
  Time = oldtime$
  msg1 = msg1 & "Time restored to: " & Time
  MsgBox msg1
End Sub
See Also Time, Time$ (statements); Date, Date$ (functions); Date, Date$ (statements); Now (function).
Note: If you do not have permission to change the time, a runtime error 70 will be generated.