date_subtract_date()

Purpose

Returns the number of days between two dates

Old name

#define date_minus_date date_subtract_date

Syntax

long date_subtract_date(date1, date2)

Parameters

datetype* date1

Pointer to first date

 

datetype* date2

Pointer to second date

Description

The date_subtract_date() function calculates the number of days by which date1 follows date2. This is negative if date1 is before date2, and zero if they are the same. It works on dates from 01 March 1600 to 31 December 9999 and uses the Gregorian calendar. It does not take account of changes from the Julian calendar which took place in English speaking countries in 1752.

Return values

Returns difference in days. (Remember that this is a long integer.)

See also

date_add_number(), date_to_number(), date_subtract_date(), number_to_date()

Example

date_subtract_date(&date1,&date2);