Within VTS, the time and date are kept as two separate numbers. The time of day is represented as the number of seconds since midnight, while the date is represented as the number of days since January 1, 1970.
The Seconds function returns the time, the Today function returns the date, and the CurrentTime function returns a combination of the two in the form of the number of seconds since January 1, 1970.
Seconds returns a double value slightly more accurate than 1 microsecond; however, when that value is assigned to a float type variable, it is rounded to about 7 significant digits. This can reduce the accuracy, especially later in the day when the seconds count gets large. To get a fairly accurate time stamp, the expression Seconds % 1 can be used to return fractions of a second since the last second mark.
These date and time numbers may be manipulated to determine elapsed time between two events simply by taking the difference between the time and date of the two events. One of the more effective ways to accomplish this is by using the CurrentTime function. You can use the single date and time number that is returned by this function to easily calculate the elapsed time between events or to calculate the date and time at a fixed offset.
The date and time numbers can be converted into text values for display purposes using the Date and Time functions. The values returned from these functions may have a variety of formats and may be displayed on the screen using a GUIText statement. The Now function can be used in a statement to give the time suitable for a Time function, or to display a simple clock.
Numeric values of the day, month, and year may be extracted from a VTS date value (number of days since January 1, 1970) using the Day, Month, and Year functions. The reverse process of combining the day, month, and year may be done using DateNum.