BeSly Software Solutions About yab Demos About us Admin


time$ -- return a string containing the current time

print time$ 
print time$() 

The time$ function returns the current time in four fields separated by hyphens '-'. The fields are:The current hour in the range from 0 to 23, padded with zeroes (e.g. 00 or 04) to a length of two characters.

The number of minutes, padded with zeroes.
The number of seconds, padded with zeroes.
The number of seconds, that have elapsed since the program has been started. This value encreases as long as your program runs and is therefore unbound and not padded with zeroes.

At the time of writing this documentation, time$ returns 22-58-53-0. Note, that the first three of the four fields returned by time$ have a fixed width; therefore it is easy to extract some fields with the usual string-functions mid$ (and others).

print "Hello it is ",time$ 
print "An empty for-loop with ten million iterations takes "
for a=1 to 10000000:next a 
print e-s," seconds" 

This program benchmarks the for-loop and uses the fourth field of the string returned by time$.

Related: date$