Stores date and time.
Note: In most cases use DateTime type instead. Its purpose is the same as of DATE. It has more functions and supports milliseconds. Use DATE only with functions that need it, for example COM functions.
The DATE type is implemented using a floating-point number (double). Days are represented by whole number increments starting with 30 December 1899, midnight as time zero. Time values are expressed as fractional part. Time precision is 1 second. Also can be used to represent date-only (the fractional part is 0) or time-only (the whole number part is 0).
To remove the time part (leave only the date part) from a DATE variable, you can assign it to an int variable. However, when converting DATE to int, result may be rounded up. To prevent it, use the member variable date. See examples.
DATE supports operator = (assign). Use it to convert string (str, lpstr, BSTR, VARIANT) containing date to DATE and vice versa.
To format date/time string, use str.timeformat.
To store date and time, also often are used types SYSTEMTIME and FILETIME:
type SYSTEMTIME @wYear @wMonth @wDayOfWeek @wDay @wHour @wMinute @wSecond @wMilliseconds type FILETIME dwLowDateTime dwHighDateTime
Here var is a variable of type DATE. Where the return type is not specified, the function returns var itself.
var.getclock
Gets current time.
var.fromsystemtime(st) var.tosystemtime(st)
Converts from SYSTEMTIME to DATE type and vice versa. Here st is a variable of type SYSTEMTIME.
var.fromfiletime(ft) var.tofiletime(ft)
Converts from FILETIME to DATE type and vice versa. Here ft is a variable of type FILETIME.
DATE d="4/1/2003" add 2 days d=d+2 out d remove the time part DATE d=10.55 int i=d out i ;;11 (rounded up) i=d.date out i ;;10 (ok)