Expressions that Calculate Time and Date

VTS counts time in seconds (and fractions of a second).  This is useful for calculating how long a pump has been running, but is not useful for humans to view.  Fortunately, VTS also provides functions that will translate the raw time into a format that is human-friendly.

 

Now(interval)                     Returns the number of seconds elapsed so far today, updated every (interval) seconds.

Time(seconds, format)     Allows you to turn the number of seconds since midnight into a format that's easier for a human to read and understand.

    Time( Now(1),  2)

                                                Returns:  21:35:00

    Time( Now(1),  7)

                                                Returns:  09:35  PM

 

Today()                                 Returns the date as a count of days.

Date(daycount, format)   Turns the result of the Today() function into a format that is easier for a human to read.

    Date(Today(),  2)

                                                Returns:  12/25/09

    Date(Today(),  21)

                                                Returns:  December 25

 

A partial list of the formatting codes for the Time function is as follows.  For a complete list of formatting codes and for other time-related functions, please refer to the VTS Programmer’s Guide, Time and Date Functions.  (Many time and date functions work only in Scripts, and thus may not be used in an expression.)

 

Formatting Code

Format

Example

0

No Time

 

1

hhmmss

173500

2

hh:mm:ss

17:35:00

6

hr:mm:ss HH

9:35:00 PM

 

The following table provides a partial list of formatting codes for the Date function.

Value

Date Format

Value

Date Format

0

No date

21 

mmm..m d

1

yymmdd

22 

mmm yyyy

2

mm/dd/yy

23 

mmm..m yyyy

3

mm-dd-yy

24 

dd/mm

mmm d, yyyy

25 

dd-mm