VBScript Time Function

Definition and Usage

The Time function can return the current system time.

Syntax

Time

Tips and Comments

Important Matters:

If Date, Time, and Now are read simultaneously, then Now = Date + Time. However, it is impossible to call all three functions at the same time because one function must be executed before the other. Therefore, if you need to obtain the current date and time simultaneously in your program, you must call Now first and then use DateValue and TimeValue to extract the date and time.

Example: Obtain the date and time of a specific time point:

N = Now 'this time point's date and time
D = Datevalue(N) 'same time point's date part
T = TimeValue(N) 'same time point's time part
D2 = Date 'time point 1's date
T2 = Time 'time point 2's time

Problem Thinking

What is the maximum possible error when executing Response.write Now and Response.Write Date + Time continuously? Assumptions:

The Now obtained from time point 1 = #7/1/95 23:59:59#
The Date obtained from time point 2 = #7/1/95#

And if the 'time point 3' just crosses a day, then Time = #0:00:00, so the difference between Now and Date+Time becomes 23:59:59.

Instance

Example 1

document.write(Time)

Output:

14:34:38

Note:The output results may vary slightly due to different computer settings.