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

## SYNOPSIS

1. n = datetime:daysTo(ref)
2. n = datetime:secsTo(ref)

## DESCRIPTION

Calculates the difference between two date/time values.

## RETURN VALUE

The time difference between ref and datetime in days or seconds, respectively.

## EXAMPLE

> > >
d1 = clock.newDateTime(1990, 1, 1) d2 = clock.newDateTime(1990, 1, 2) print (d1:daysTo(d2), d1:secsTo(d2))
1 86400

## SEE ALSO

clock.currentDateTime, clock.newDateTime, clock.setDateTime, clock.tzget, clock.tzset, datetime(), datetime:addDays, datetime:addMonths, datetime:addSecs, datetime:addYears, datetime:base90, datetime:date, datetime:day, datetime:format, datetime:hour, datetime:isNull, datetime:isValid, datetime:isdst, datetime:minute, datetime:month, datetime:msec, datetime:offset, datetime:second, datetime:set, datetime:setBase90, datetime:time, datetime:toLocal, datetime:toUTC, datetime:year, datetime:zone, tostring(datetime)