Date Type

A Date variable represents a specific day since the start of the Julian period. The Date primitive type defines the protocol for comparing and manipulating dates.

In JADE thin client mode, local variables of type Date are always initialized to the date relative to the presentation client.

Dates are generally obtained from user input in a Gregorian Calendar format, and converted to the internal (Julian day) format for internal storage and computation. Strictly speaking, the valid range for Julian day numbers is 0 through 2914726, which are the limits of the current Julian Period (7980 Julian years in length). This supports a valid date range from 24 November -4713 through 23 February 3268, Gregorian. However, JADE does not adhere to this limit, and allows day numbers to extend beyond this range.

When the EnhancedLocaleSupport parameter in the [JadeEnvironment] section of the JADE initialization file is set to true, the Windows Control Panel setting is used to convert a two‑digit year into a four‑digit year for a two‑digit edit mask year of yy using the current century; for example, 99 by default becomes 1999 rather than 2099.

JADE handles any calendar available within Microsoft Windows, including the conversion and display of non‑Gregorian calendar dates, based on the locale and calendar set for the current user.

JADE prevents the use of the day 0 or a null value as a valid date, since the Julian day 0 is considered to be null. The maximum Julian day number is not imposed as the maximum date permitted by JADE.

write (1).Date // displays 25 November -4713 (one day higher than Day zero)
write (0).Date // displays null (but internally represents 24 November -4713)

The variable contains the current date as a Julian day number. (For details, see "Historical Note about the Date Type", in the following subsection.)

When used as a Dictionary key, the valid range for a Date key is (0).Date through (Max_Integer).Date.

If you declare a Date primitive type local variable in your method that is referenced within the code of the method, it is initialized with the current date each time the method that declares the variable is invoked. If such a local variable is declared but is not referenced in the code, its value is not initialized. Object attributes of type Date are initialized to null.

As Date primitive types are ordinal values (Julian day numbers), the forms of date arithmetic expressions listed in the following table are valid.

Expression Expression Type
date-expression + integer-expression (date)
date-expression - integer-expression (date)
date-expression - date-expression (integer)

The following assignment shows the calculation of a date 134 days later than a specified date:

date2 := date1+134;

You can use the JadeEditMask class getTextAsDate and setTextFromDate methods to handle locale formatting for date fields.

For details about the methods defined in the Date primitive type, see "Date Methods", and for examples of the use of this primitive type, see "Date Primitive Type Examples", later in this section. For details about converting primitive types, see "Converting Primitive Types", in Chapter 1 of the JADE Developer’s Reference.