calcDays()

Calculate the number of days between this date and another date.

Syntax

public int calcDays(DtpDate date

Parameters

date
The date to compare with this date.

Return values

An int representing the number of days. This is always a positive number.

Exceptions

DtpDateException
 

Notes

The calcDays() method calculates the difference in the number of days between this date and another date. The result is always a whole number of days.

The difference between 19990615 00:30:59 and 19990615 23:59:59 is 0 days, and the difference between 19990615 23:59:59 and 19990616 00:01:01 is 1 day.

Examples

try
    {
    DtpDate toDay = new DtpDate();
    DtpDate tomorrow = toDay.addDays(1);
    int days = today.caldDays(tomorrow);
    }
 catch ( DtpDateException date_e )
    {
    System.out.println(date_e.getMessage());
    }
 

See also

calcWeekdays()

Copyright IBM Corp. 1997, 2003