DA Functions: Converting a Legacy Date to an Integer

How to:

The DA functions convert a legacy date to the number of days between a specific day in the past, called 'base date', and a specified date. By converting a date to the number of days, you can subtract dates and calculate the intervals between them, or you can add to or subtract numbers from the dates to get new dates.

You can convert the result of a DA function back to a legacy date using the DT functions.


Top of page

x
Syntax: How to Convert a Legacy Date to an Integer
function(indate, output_format)

where:

function

Is one of the following:

DADMY converts a date in day-month-year format.
DADYM converts a date in day-year-month format.
DAMDY converts a date in month-day-year format.
DAMYD converts a date in month-year-day format.
DAYDM converts a date in year-day-month format.
DAYMD converts a date in year-month-day format.

indate

I6xxx, where xxx corresponds to the function DAxxx in the list above.

Is the legacy date to be converted. If indate is a numeric literal, enter only the last two digits of the year; the function assumes the century component. If the date is invalid, the function returns a 0.

output_format

Integer



Example: Converting Dates and Calculating the Difference Between Them

DAYMD converts DAT_INC and HIRE_DATE to the number of days since December 31, 1899 and the smaller number is then subtracted from the larger number:

DAYMD(DAT_INC, 'I8') - DAYMD(HIRE_DATE, 'I8')

iWay Software