DA Functions: Converting a Legacy Date to an Integer

How to:

The DA functions convert a legacy date to the number of days between it and a base date. By converting a date to the number of days, you can add and 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 back to a date using the DT functions discussed in DT Functions: Converting an Integer to a Date.

There are six DA functions; each one accepts a date in a different format.


Top of page

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

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 or P6xxx, where xxx corresponds to the function DAxxx you are using.

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

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