Date/Time Functions

<< Click to Display Table of Contents >>

Navigation:  Reference (Scripting) > VBScript Basics >

Date/Time Functions

 

Date Function

 

'Example Date Function

DL.ClearCommWindows

DL.AddComment Date   ' prints the current system date.

 

 

Time Function

 

'Example Time Function

DL.ClearCommWindows

DL.AddComment Time   ' prints the current system time.

 

 

Timer Function

 

'Example Timer Function

'The Timer function returns the number of seconds that have elapsed

'since 12:00 AM (midnight).

StartTime = Timer  

For i = 1 To 1000

Next

DL.AddComment "Duration [milliseconds] = " & (Timer - StartTime) * 1000

 

 

Now Function

 

'Example Now Function

Dim MyVar

MyVar = Now ' MyVar contains the current date and time.

 

 

Day Function

 

'Example Day Function

DL.AddComment Day(Now)

 

 

Month Function

 

'Example Month Function

DL.AddComment Month(Now)

 

 

Year Function

 

'Example Year Function

Dim MyDate

MyDate = #December 7, 1968#   ' Assign a date.

DL.AddComment Year(MyDate)

 

 

Hour Function

 

'Example Hour Function

DL.AddComment Hour(Now)

 

 

Minute Function

 

'Example Minute Function

DL.AddComment Minute(Now)

 

 

Second Function

 

'Example Second Function

DL.AddComment Second(Now)