Date and Time functions

Top  Previous  Next

Date and time are always important in data acquisition applications.  As such we give you a few handy functions.  All of them start with "dateTime."

dateTime.dateFormat: a variable that can contain either "mdy" or "dmy".  The default is "mdy".  Changing it to "dmy" will change how date values are displayed across the application.

dateTime.systemTime() : returns the current browser system time in Javascript time format, milliseconds since 1970.  It is basically the equivalent of: (new Date).getTime() in Javascript.

dateTime.printDate(val): prints the specified date value in either m/d/y or d/m/y format.

dateTime.printTime(val, ms, sec): prints the specified date value's time portion.  By default, seconds and milliseconds are displayed.  Set ms and/or sec to false to turn them off.

dateTime.printDateTime(val, ms): prints both the date and time for the specified value.  If ms is set to false, milliseconds are not displayed.

 

Advanced: you can also access the dateTime object from global Javascript using $.dc.dateTime.  dateTime in the sandbox is simply a reference to the global object.