Or login with:
| intdateDiff360( | int | startDate | |
| int | endDate | ||
| dateDiffType | type = dd_USA | ) |
| Type | Description |
| dd_Europe | Start or end dates that occur on the 31st of a month become equal to the 30th of the same month. |
| dd_USA | This is identical to the European system with one exception that applies only to end dates: If the end date occurs on the 31st of a month it is moved to the 1st of the next month if the start date is earlier than the 30th. This method is sometime also called the 'NASD' method. |
#include <stdio.h> #include <codecogs/units/date/datediff360.h> #include <codecogs/units/date/date.h> using namespace Units::Date; int main() { printf("\n Diff 360=%d days", dateDiff360(date("27-2-2004"), date("20-8-2005"))); // 533 printf("\n Diff 360=%d days", dateDiff360(date("28-2-2004"), date("20-8-2005"))); // 532 printf("\n Diff 360=%d days", dateDiff360(date("29-2-2004"), date("20-8-2005"))); // 530 printf("\n Diff 360=%d days", dateDiff360(date("1-3-2004"), date("20-8-2005"))); // 529 printf("\n\n Diff 360=%d days", dateDiff360(date("29-3-2004"), date("20-8-2005"))); // 501 printf("\n Diff 360=%d days", dateDiff360(date("30-3-2004"), date("20-8-2005"))); // 500 printf("\n Diff 360=%d days", dateDiff360(date("31-3-2004"), date("20-8-2005"))); // 500 printf("\n Diff 360=%d days", dateDiff360(date("32-3-2004"), date("20-8-2005"))); // 499 printf("\n\n Diff 360=%d days", dateDiff360(date("15-3-2004"), date("30-10-2005")));// 585 printf("\n Diff 360=%d days", dateDiff360(date("16-3-2004"), date("31-10-2005"))); // 585 printf("\n Diff 360=%d days", dateDiff360(date("29-3-2004"), date("30-10-2005"))); // 571 printf("\n Diff 360=%d days", dateDiff360(date("31-3-2004"), date("31-10-2005"))); // 570 printf("\n\n Diff 360=%d days", dateDiff360(date("28-2-2004"), date("31-10-2005")));// 603 printf("\n Diff 360=%d days", dateDiff360(date("29-2-2004"), date("31-10-2005"))); // 601 return 0; }
| startDate | and... |
| endDate | are 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. |
| type | defines which accounting date system to use: |
Source code is available when you agree to a GP Licence or buy a Commercial Licence.
Not a member, then Register with CodeCogs. Already a Member, then Login.
You must login to leave a messge