I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
COST (GBP)
this unit 4.21
sub units 0.00
+
0
UnitsDate

date Diff

Computes the number of days between two serial Julian dates Open Office: DATEDIFF
Controller: CodeCogs

add cart

Interface

C++
Excel
HTML

DateDiff

 
intdateDiffintstartDate
intendDate )[inline]
Returns the number of days between two serial Julian dates. Aside from adding clarity to your code, we can see few reasons for anyone to use this function directly, we only provide it for completeness against Excel. For something more involved see dateDiff360. We recommend that you make the necessary subtraction yourself, the entire function is only:
inline int dateDiff(int nDateStart, int nDateEnd)
{
  return nDateStart - nDateEnd;
}

Example:

#include <stdio.h>
#include <codecogs/units/date/date.h>
using namespace Units::Date;
 
void main()
{
printf("\n Difference=%d days", dateDiff(date("12-8-2004"), date("20-8-2004")));  // Difference=8
days
}

Parameters

startDateand...
endDateare serial Julian dates (see date ). The return value is signed, so if StartDate occurs before endDate then a negative answer will be returned. See date , for details on creating these numbers.

Authors

Will Bateman (Oct 2004)
Source Code

Source code is available when you buy a Commercial licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.