DateTime is a standard OLE data type. DateTime variables are stored as IEEE 64-bit, 8-byte floating-point numbers (Double type) representing the number of days from midnight, 30 December 1899.
For example, midnight, 31 December 1899 is represented by 1.0; 6 A.M., 1 January 1900 is represented by 2.25; midnight, 29 December 1899 is represented by -1.0; and 6 A.M., 29 December 1899 is represented by -1.25.
When other numeric data types are converted to DateTime type, values to the left of the decimal point represent the date information while values to the right of the decimal point (the fractional part) represent the time of day. Midnight is 0 (default value - "12:00:00 AM") and midday is 0.5 ("12:00:00 PM"). The value 2.0 represents January 1, 1900 and 3.0 represents January 2, 1900. Adding 1 to the value increases the date by one day.
DateTime variables display dates according to the short date format recognized by your computer and times displayed according to the time format (either 12-hour or 24-hour) recognized by your computer.
Negative whole numbers represent dates before 30 December 1899.
The following table includes more examples:
Numerics Numbers |
Date Time |
String Value |
0 |
midnight |
"12:00:00 AM" (Default) |
0.5 |
midday |
"12:00:00 PM" |
2.0 |
January 1, 1900 |
"1/1/1900" |
3.0 |
January 2, 1900 |
"1/2/1900" |
2.5 |
12 o'clock noon on January 1, 1900 |
"1/1/1900 12:00:00 PM" |
3.875 |
9:00 p.m. on January 2, 1900 |
"1/2/1900 9:00:00 PM" |
DateTime is similar to the OLE standard date data type and its values can be exchanged with Visual Basic programs.
Any recognizable string date/time values can be assigned to its variables and its values can be set to a string; that is you can assign DateTime to String and vice versa, for example:
dtCurDateTime="9/20/2007 2:28:00 PM"
str=dtCurDateTime.
DateTime Strings are accurate to 1 second.
In ATEasy 2024/v13 the functions that returns DateTime such as Now() or Properties such as EndTime were updated to return the time accurate to 100 nSec from 1 Sec in earlier versions.
The following examples shows how to calculate the time difference between two DateTime values in mSec:
! calculate time difference
dtOneSec="12:00:01 AM" ! one second past
after 0 value
dOneSec=dtOneSec ! floating point
value of one sec.
dt1="9/30/2008 23:59"
dt2="10/1/2008 00:01"
dDiff=(dt2-dt1)/dOneSec*1000
print "Time Diff is "; dDiff; " mSec"
Basic Data Types, Data Conversion, String Data Types, User Defined Data Types, Now