Get Current Time Method
This method returns a string that contains the current time. It returns an eight character string of the following format:
hh:mm:ss
where:
hh is the hour
mm is the minute
ss is the second
The hour uses a 24 hour clock in the range of 0 through 23.
Format
Time[$]
For information about the dollar sign, see Usage of the Dollar Sign.
This method does not include arguments.
Example
The following example writes data to a file if it has not been saved in the last two minutes:
Sub Button_Click
Dim tempfile
Dim filetime, curtime
Dim msgtext
Dim acctno(100) as Single
Dim x, I
tempfile = "c:\temp001"
Open tempfile For Output As #1
filetime = FileDateTime(tempfile)
x = 1
I = 1
acctno(x) = 0
Do
curtime = Time
acctno(x) = 44
If acctno(x) = 99 then
For I = 1 to x -1
Write #1, acctno(I)
Next I
Exit Do
ElseIf (Minute(filetime) + 2)< = Minute(curtime) then
For I = I to x
Write #1, acctno(I)
Next I
End If
x = x + 1
Loop
Close #1
x = 1
msgtext = "Contents of c:\temp001 is:" & Chr(10)
Open tempfile for Input as #1
Do While Eof(1) <> -1
Input #1, acctno(x)
msgtext = msgtext & Chr(10) & acctno(x)
x = x + 1
Loop
Close #1
Kill "c:\temp001"
End Sub