Home Contents | # date:daysTo | Date/Time | Core4 Lua Commands

## SYNOPSIS

n = date:daysTo(ref)

## DESCRIPTION

Calculates the difference in days between two date values.

## RETURN VALUE

The time difference between ref and date in days.

## ERRORS

Raises an error if time or ref is not a date instance.

## EXAMPLE

> > >
d1 = clock.newDate(1990, 1, 1) d2 = clock.newDate(1991, 1, 1) print (d1:daysTo(d2))
365

## SEE ALSO

clock.currentDate, clock.newDate, date(), date:addDays, date:addMonths, date:addYears, date:day, date:dayOfWeek, date:dayOfYear, date:days90, date:daysInMonth, date:daysInYear, date:format, date:isNull, date:isValid, date:month, date:set, date:setDays90, date:weekNumber, date:year, tostring(date)