In the Q++ Macro Language, there is no special data type for dates. This may seem strange in a language designed for diary production, but there is no need for a special "date" data type.

Q++ uses integers to represent dates in its internal and macro calculations.

•December 30th 1899 (don't ask why, it's a standard) is date 0 (zero) and dates are counted from that day on. Using this method, January 1st 2000 is date 36526.

•When Q++ needs to display the value of an integer variable (in the Macros Editor or the Debugger) it displays any value less than 30000 as a number, and any value above 30000 as a number with the equivalent date in parentheses (for example : 30000 (Thu 18-feb-1982)).

The fact that integers and dates are the same, means that the following code, mixing dates and integers, is valid (since they are the same) :

nTomorrow = Today() + 1

nAge = (Today() - nBirthDate) div 365

The above would not be valid if the date and integer types were different, and you would need to use conversion functions or special date functions. The above seems much more intuitive.

Topic 135000 updated on 01-Nov-16.

Topic URL: https://www.qppstudio.net/webhelp/index.html?datesasintegers.htm