Time Statement

Syntax

Time = time

time

Use: Required

Data Type: Variant

Any valid time expression.

Description

Sets the current system time.

Rules at a Glance

The Time statement attempts to evaluate the variant you are assigning as a valid time; if it can't be converted to a valid time, a runtime error is generated.

Programming Tips and Gotchas

  • It's not a good idea to independently set the date and time in a networked environment. Instead, the log-on script of each workstation should include code to set the date and time of the workstation to be that of the PDC or another centrally used server.

  • You can use the Time function to return the current system time.

See Also

Time Function

Get VB & VBA in a Nutshell: The Language now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.