number_to_date

This function converts a number to an ITP date number. This ITP date number, then, can be used in all ITP's data functions.

number_to_date ( input_number; date_mask ) 

The result of this function is of type NUMBER; an ITP date number that has the format YYYYMMDD.

This function has two parameters:

  1. input_number, type NUMBER. This is the number in which in one way or another a date is encoded.
  2. date_mask, type TEXT. A mask that describes the way the date is encoded in the input_number. Refer for a description of how the mask must be constructed to the following.
The mask

In the mask the location and the number of digits used to encode the year, the month and the day, are shown by using Y for a year digit, MM for the months digits and DD for the day digits.

To indicate the year you can use three kinds of indications in the mask:

  1. YY
    Where YY is assumed relative to the year 2000.
  2. YYY
    Where 19YY is assumed in case of 0YY and 20YY in case of 1YY.
  3. YYYY
    Allows for a value between -9999 and 9999.

For example 120501 as input with the mask MMDDYY tells us that the date is the fifth of December 2009; 12 is the month, 05 the day and 01 is the year from 2000.

Example

@( number_to_date( 120501; "MMDDYY" ) ) 

Result: 20,011,205.00

@( number_to_date( 1209305; "MMYYYDD" ) ) 

Result: 19,931,205.00

@( number_to_date( 1219305; "MMYYYDD" ) ) 

Result: 20,931,205.00

@( number_to_date( 19930512; "YYYYDDMM" ) ) 

Result: 19,931,205.00

Note that the construction @ ( ) around the function means that the result of the function is displayed in the text. This construction must be used in a text part of a model document. The switch from ITP mode to text mode in a model document is made with the # characters. An ITP model document starts in text model, the #BEGIN makes the switch to ITP mode.