From 115c7ddfdd16e742de67b00844d0d09e11c88d5f Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sat, 16 Dec 2006 20:22:14 +0000 Subject: [PATCH] Reverse order of arguments to DATEDIFF, for compatibility. Thanks to Daniel Williams for reporting this bug. --- doc/expressions.texi | 2 +- src/language/expressions/ChangeLog | 6 +- src/language/expressions/helpers.c | 2 +- src/language/expressions/operations.def | 2 +- tests/ChangeLog | 5 + tests/expressions/expressions.sh | 358 ++++++++++++------------ 6 files changed, 192 insertions(+), 183 deletions(-) diff --git a/doc/expressions.texi b/doc/expressions.texi index 540cad22..a03a2fd4 100644 --- a/doc/expressions.texi +++ b/doc/expressions.texi @@ -1027,7 +1027,7 @@ before performing analysis. PSPP supplies a few functions for date arithmetic: -@deftypefn {Function} {} DATEDIFF (@var{date1}, @var{date2}, @var{unit}) +@deftypefn {Function} {} DATEDIFF (@var{date2}, @var{date1}, @var{unit}) Returns the span of time from @var{date1} to @var{date2} in terms of @var{unit}, which must be a quoted string, one of @samp{years}, @samp{quarters}, @samp{months}, @samp{weeks}, @samp{days}, diff --git a/src/language/expressions/ChangeLog b/src/language/expressions/ChangeLog index a55b977f..98df4a36 100644 --- a/src/language/expressions/ChangeLog +++ b/src/language/expressions/ChangeLog @@ -1,4 +1,8 @@ -Wed Dec 13 19:33:52 2006 Ben Pfaff +Sat Dec 16 12:20:14 2006 Ben Pfaff + + * operations.def: Reverse order of arguments to DATEDIFF, for + compatibility. Thanks to Daniel Williams + for reporting this bug. Wed Dec 13 19:30:26 2006 Ben Pfaff diff --git a/src/language/expressions/helpers.c b/src/language/expressions/helpers.c index a07282be..08986b29 100644 --- a/src/language/expressions/helpers.c +++ b/src/language/expressions/helpers.c @@ -261,7 +261,7 @@ date_unit_duration (enum date_unit unit) } } -/* Returns the span from DATE to DATE2 in terms of UNIT_NAME. */ +/* Returns the span from DATE1 to DATE2 in terms of UNIT_NAME. */ double expr_date_difference (double date1, double date2, struct substring unit_name) { diff --git a/src/language/expressions/operations.def b/src/language/expressions/operations.def index 05d6e804..59f2493e 100644 --- a/src/language/expressions/operations.def +++ b/src/language/expressions/operations.def @@ -318,7 +318,7 @@ function XDATE.WKDAY (date >= DAY_S) = calendar_offset_to_wday (date / DAY_S); function XDATE.YEAR (date >= DAY_S) = calendar_offset_to_year (date / DAY_S); // Date arithmetic functions. -no_abbrev function DATEDIFF (date1 >= DAY_S, date2 >= DAY_S, string unit) +no_abbrev function DATEDIFF (date2 >= DAY_S, date1 >= DAY_S, string unit) = expr_date_difference (date1, date2, unit); no_abbrev function DATESUM (date, quantity, string unit) = expr_date_sum (date, quantity, unit, ss_cstr ("closest")); diff --git a/tests/ChangeLog b/tests/ChangeLog index fe424a1e..a1375802 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,8 @@ +Sat Dec 16 12:20:58 2006 Ben Pfaff + + * expressions/expressions.sh: Fix DATEDIFF function tests to + correspond with change to DATEDIFF. + Wed Dec 13 19:34:29 2006 Ben Pfaff * expressions/expressions.sh: Test DATEDIFF, DATESUM functions. diff --git a/tests/expressions/expressions.sh b/tests/expressions/expressions.sh index 88c9bafa..c8714894 100755 --- a/tests/expressions/expressions.sh +++ b/tests/expressions/expressions.sh @@ -1261,189 +1261,189 @@ xdate.year(date.mdy(2,25,96) + time.hms(21,30,57)) => 1996.00 xdate.year(date.mdy(11,10,2038) + time.hms(22,30,4)) => 2038.00 xdate.year(date.mdy(7,18,2094) + time.hms(1,56,51)) => 2094.00 -datediff(date.mdy(6,10,1648), date.mdy(6,30,1680), 'years') => 32.00 -datediff(date.mdy(6,30,1680), date.mdy(7,24,1716), 'years') => 36.00 -datediff(date.mdy(7,24,1716), date.mdy(6,19,1768), 'years') => 51.00 -datediff(date.mdy(6,19,1768), date.mdy(8,2,1819), 'years') => 51.00 -datediff(date.mdy(8,2,1819), date.mdy(3,27,1839), 'years') => 19.00 -datediff(date.mdy(3,27,1839), date.mdy(4,19,1903), 'years') => 64.00 -datediff(date.mdy(4,19,1903), date.mdy(8,25,1929), 'years') => 26.00 -datediff(date.mdy(8,25,1929), date.mdy(9,29,1941), 'years') => 12.00 -datediff(date.mdy(9,29,1941), date.mdy(4,19,1943), 'years') => 1.00 +datediff(date.mdy(6,10,1648), date.mdy(6,30,1680), 'years') => -32.00 +datediff(date.mdy(6,30,1680), date.mdy(7,24,1716), 'years') => -36.00 +datediff(date.mdy(7,24,1716), date.mdy(6,19,1768), 'years') => -51.00 +datediff(date.mdy(6,19,1768), date.mdy(8,2,1819), 'years') => -51.00 +datediff(date.mdy(8,2,1819), date.mdy(3,27,1839), 'years') => -19.00 +datediff(date.mdy(3,27,1839), date.mdy(4,19,1903), 'years') => -64.00 +datediff(date.mdy(4,19,1903), date.mdy(8,25,1929), 'years') => -26.00 +datediff(date.mdy(8,25,1929), date.mdy(9,29,1941), 'years') => -12.00 +datediff(date.mdy(9,29,1941), date.mdy(4,19,1943), 'years') => -1.00 datediff(date.mdy(4,19,1943), date.mdy(10,7,1943), 'years') => 0.00 -datediff(date.mdy(10,7,1943), date.mdy(3,17,1992), 'years') => 48.00 -datediff(date.mdy(3,17,1992), date.mdy(2,25,1996), 'years') => 3.00 -datediff(date.mdy(9,29,41), date.mdy(2,25,1996), 'years') => 54.00 -datediff(date.mdy(9,29,41), date.mdy(4,19,43), 'years') => 1.00 +datediff(date.mdy(10,7,1943), date.mdy(3,17,1992), 'years') => -48.00 +datediff(date.mdy(3,17,1992), date.mdy(2,25,1996), 'years') => -3.00 +datediff(date.mdy(9,29,41), date.mdy(2,25,1996), 'years') => -54.00 +datediff(date.mdy(9,29,41), date.mdy(4,19,43), 'years') => -1.00 datediff(date.mdy(4,19,43), date.mdy(10,7,43), 'years') => 0.00 -datediff(date.mdy(10,7,43), date.mdy(3,17,92), 'years') => 48.00 -datediff(date.mdy(3,17,92), date.mdy(2,25,96), 'years') => 3.00 -datediff(date.mdy(2,25,96), date.mdy(11,10,2038), 'years') => 42.00 -datediff(date.mdy(11,10,2038), date.mdy(7,18,2094), 'years') => 55.00 -datediff(date.mdy(2,29,1900), date.mdy(2,29,1904), 'years') => 3.00 -datediff(date.mdy(2,29,1904), date.mdy(2,29,1908), 'years') => 4.00 -datediff(date.mdy(2,29,1900), date.mdy(2,28,1903), 'years') => 2.00 - -datediff(date.mdy(6,10,1648), date.mdy(6,30,1680), 'quarters') => 128.00 -datediff(date.mdy(6,30,1680), date.mdy(7,24,1716), 'quarters') => 144.00 -datediff(date.mdy(7,24,1716), date.mdy(6,19,1768), 'quarters') => 207.00 -datediff(date.mdy(6,19,1768), date.mdy(8,2,1819), 'quarters') => 204.00 -datediff(date.mdy(8,2,1819), date.mdy(3,27,1839), 'quarters') => 78.00 -datediff(date.mdy(3,27,1839), date.mdy(4,19,1903), 'quarters') => 256.00 -datediff(date.mdy(4,19,1903), date.mdy(8,25,1929), 'quarters') => 105.00 -datediff(date.mdy(8,25,1929), date.mdy(9,29,1941), 'quarters') => 48.00 -datediff(date.mdy(9,29,1941), date.mdy(4,19,1943), 'quarters') => 6.00 -datediff(date.mdy(4,19,1943), date.mdy(10,7,1943), 'quarters') => 1.00 -datediff(date.mdy(10,7,1943), date.mdy(3,17,1992), 'quarters') => 193.00 -datediff(date.mdy(3,17,1992), date.mdy(2,25,1996), 'quarters') => 15.00 -datediff(date.mdy(9,29,41), date.mdy(2,25,1996), 'quarters') => 217.00 -datediff(date.mdy(9,29,41), date.mdy(4,19,43), 'quarters') => 6.00 -datediff(date.mdy(4,19,43), date.mdy(10,7,43), 'quarters') => 1.00 -datediff(date.mdy(10,7,43), date.mdy(3,17,92), 'quarters') => 193.00 -datediff(date.mdy(3,17,92), date.mdy(2,25,96), 'quarters') => 15.00 -datediff(date.mdy(2,25,96), date.mdy(11,10,2038), 'quarters') => 170.00 -datediff(date.mdy(11,10,2038), date.mdy(7,18,2094), 'quarters') => 222.00 -datediff(date.mdy(2,29,1900), date.mdy(2,29,1904), 'quarters') => 15.00 -datediff(date.mdy(2,29,1904), date.mdy(2,29,1908), 'quarters') => 16.00 -datediff(date.mdy(2,29,1900), date.mdy(2,28,1903), 'quarters') => 11.00 - -datediff(date.mdy(6,10,1648), date.mdy(6,30,1680), 'months') => 384.00 -datediff(date.mdy(6,30,1680), date.mdy(7,24,1716), 'months') => 432.00 -datediff(date.mdy(7,24,1716), date.mdy(6,19,1768), 'months') => 622.00 -datediff(date.mdy(6,19,1768), date.mdy(8,2,1819), 'months') => 613.00 -datediff(date.mdy(8,2,1819), date.mdy(3,27,1839), 'months') => 235.00 -datediff(date.mdy(3,27,1839), date.mdy(4,19,1903), 'months') => 768.00 -datediff(date.mdy(4,19,1903), date.mdy(8,25,1929), 'months') => 316.00 -datediff(date.mdy(8,25,1929), date.mdy(9,29,1941), 'months') => 145.00 -datediff(date.mdy(9,29,1941), date.mdy(4,19,1943), 'months') => 18.00 -datediff(date.mdy(4,19,1943), date.mdy(10,7,1943), 'months') => 5.00 -datediff(date.mdy(10,7,1943), date.mdy(3,17,1992), 'months') => 581.00 -datediff(date.mdy(3,17,1992), date.mdy(2,25,1996), 'months') => 47.00 -datediff(date.mdy(9,29,41), date.mdy(2,25,1996), 'months') => 652.00 -datediff(date.mdy(9,29,41), date.mdy(4,19,43), 'months') => 18.00 -datediff(date.mdy(4,19,43), date.mdy(10,7,43), 'months') => 5.00 -datediff(date.mdy(10,7,43), date.mdy(3,17,92), 'months') => 581.00 -datediff(date.mdy(3,17,92), date.mdy(2,25,96), 'months') => 47.00 -datediff(date.mdy(2,25,96), date.mdy(11,10,2038), 'months') => 512.00 -datediff(date.mdy(11,10,2038), date.mdy(7,18,2094), 'months') => 668.00 -datediff(date.mdy(2,29,1900), date.mdy(2,29,1904), 'months') => 47.00 -datediff(date.mdy(2,29,1904), date.mdy(2,29,1908), 'months') => 48.00 -datediff(date.mdy(2,29,1900), date.mdy(2,28,1903), 'months') => 35.00 - -datediff(date.mdy(6,10,1648), date.mdy(6,30,1680), 'weeks') => 1672.00 -datediff(date.mdy(6,30,1680), date.mdy(7,24,1716), 'weeks') => 1881.00 -datediff(date.mdy(7,24,1716), date.mdy(6,19,1768), 'weeks') => 2708.00 -datediff(date.mdy(6,19,1768), date.mdy(8,2,1819), 'weeks') => 2667.00 -datediff(date.mdy(8,2,1819), date.mdy(3,27,1839), 'weeks') => 1025.00 -datediff(date.mdy(3,27,1839), date.mdy(4,19,1903), 'weeks') => 3342.00 -datediff(date.mdy(4,19,1903), date.mdy(8,25,1929), 'weeks') => 1375.00 -datediff(date.mdy(8,25,1929), date.mdy(9,29,1941), 'weeks') => 631.00 -datediff(date.mdy(9,29,1941), date.mdy(4,19,1943), 'weeks') => 81.00 -datediff(date.mdy(4,19,1943), date.mdy(10,7,1943), 'weeks') => 24.00 -datediff(date.mdy(10,7,1943), date.mdy(3,17,1992), 'weeks') => 2527.00 -datediff(date.mdy(3,17,1992), date.mdy(2,25,1996), 'weeks') => 205.00 -datediff(date.mdy(9,29,41), date.mdy(2,25,1996), 'weeks') => 2838.00 -datediff(date.mdy(9,29,41), date.mdy(4,19,43), 'weeks') => 81.00 -datediff(date.mdy(4,19,43), date.mdy(10,7,43), 'weeks') => 24.00 -datediff(date.mdy(10,7,43), date.mdy(3,17,92), 'weeks') => 2527.00 -datediff(date.mdy(3,17,92), date.mdy(2,25,96), 'weeks') => 205.00 -datediff(date.mdy(2,25,96), date.mdy(11,10,2038), 'weeks') => 2228.00 -datediff(date.mdy(11,10,2038), date.mdy(7,18,2094), 'weeks') => 2905.00 -datediff(date.mdy(2,29,1900), date.mdy(2,29,1904), 'weeks') => 208.00 -datediff(date.mdy(2,29,1904), date.mdy(2,29,1908), 'weeks') => 208.00 -datediff(date.mdy(2,29,1900), date.mdy(2,28,1903), 'weeks') => 156.00 - -datediff(date.mdy(6,10,1648), date.mdy(6,30,1680), 'days') => 11708.00 -datediff(date.mdy(6,30,1680), date.mdy(7,24,1716), 'days') => 13172.00 -datediff(date.mdy(7,24,1716), date.mdy(6,19,1768), 'days') => 18958.00 -datediff(date.mdy(6,19,1768), date.mdy(8,2,1819), 'days') => 18670.00 -datediff(date.mdy(8,2,1819), date.mdy(3,27,1839), 'days') => 7177.00 -datediff(date.mdy(3,27,1839), date.mdy(4,19,1903), 'days') => 23398.00 -datediff(date.mdy(4,19,1903), date.mdy(8,25,1929), 'days') => 9625.00 -datediff(date.mdy(8,25,1929), date.mdy(9,29,1941), 'days') => 4418.00 -datediff(date.mdy(9,29,1941), date.mdy(4,19,1943), 'days') => 567.00 -datediff(date.mdy(4,19,1943), date.mdy(10,7,1943), 'days') => 171.00 -datediff(date.mdy(10,7,1943), date.mdy(3,17,1992), 'days') => 17694.00 -datediff(date.mdy(3,17,1992), date.mdy(2,25,1996), 'days') => 1440.00 -datediff(date.mdy(9,29,41), date.mdy(2,25,1996), 'days') => 19872.00 -datediff(date.mdy(9,29,41), date.mdy(4,19,43), 'days') => 567.00 -datediff(date.mdy(4,19,43), date.mdy(10,7,43), 'days') => 171.00 -datediff(date.mdy(10,7,43), date.mdy(3,17,92), 'days') => 17694.00 -datediff(date.mdy(3,17,92), date.mdy(2,25,96), 'days') => 1440.00 -datediff(date.mdy(2,25,96), date.mdy(11,10,2038), 'days') => 15599.00 -datediff(date.mdy(11,10,2038), date.mdy(7,18,2094), 'days') => 20339.00 -datediff(date.mdy(2,29,1900), date.mdy(2,29,1904), 'days') => 1460.00 -datediff(date.mdy(2,29,1904), date.mdy(2,29,1908), 'days') => 1461.00 -datediff(date.mdy(2,29,1900), date.mdy(2,28,1903), 'days') => 1094.00 - -datediff(date.mdy(6,30,1680), date.mdy(6,10,1648), 'years') => -32.00 -datediff(date.mdy(7,24,1716), date.mdy(6,30,1680), 'years') => -36.00 -datediff(date.mdy(6,19,1768), date.mdy(7,24,1716), 'years') => -51.00 -datediff(date.mdy(8,2,1819), date.mdy(6,19,1768), 'years') => -51.00 -datediff(date.mdy(3,27,1839), date.mdy(8,2,1819), 'years') => -19.00 -datediff(date.mdy(4,19,1903), date.mdy(3,27,1839), 'years') => -64.00 -datediff(date.mdy(8,25,1929), date.mdy(4,19,1903), 'years') => -26.00 -datediff(date.mdy(9,29,1941), date.mdy(8,25,1929), 'years') => -12.00 -datediff(date.mdy(4,19,1943), date.mdy(9,29,1941), 'years') => -1.00 +datediff(date.mdy(10,7,43), date.mdy(3,17,92), 'years') => -48.00 +datediff(date.mdy(3,17,92), date.mdy(2,25,96), 'years') => -3.00 +datediff(date.mdy(2,25,96), date.mdy(11,10,2038), 'years') => -42.00 +datediff(date.mdy(11,10,2038), date.mdy(7,18,2094), 'years') => -55.00 +datediff(date.mdy(2,29,1900), date.mdy(2,29,1904), 'years') => -3.00 +datediff(date.mdy(2,29,1904), date.mdy(2,29,1908), 'years') => -4.00 +datediff(date.mdy(2,29,1900), date.mdy(2,28,1903), 'years') => -2.00 + +datediff(date.mdy(6,10,1648), date.mdy(6,30,1680), 'quarters') => -128.00 +datediff(date.mdy(6,30,1680), date.mdy(7,24,1716), 'quarters') => -144.00 +datediff(date.mdy(7,24,1716), date.mdy(6,19,1768), 'quarters') => -207.00 +datediff(date.mdy(6,19,1768), date.mdy(8,2,1819), 'quarters') => -204.00 +datediff(date.mdy(8,2,1819), date.mdy(3,27,1839), 'quarters') => -78.00 +datediff(date.mdy(3,27,1839), date.mdy(4,19,1903), 'quarters') => -256.00 +datediff(date.mdy(4,19,1903), date.mdy(8,25,1929), 'quarters') => -105.00 +datediff(date.mdy(8,25,1929), date.mdy(9,29,1941), 'quarters') => -48.00 +datediff(date.mdy(9,29,1941), date.mdy(4,19,1943), 'quarters') => -6.00 +datediff(date.mdy(4,19,1943), date.mdy(10,7,1943), 'quarters') => -1.00 +datediff(date.mdy(10,7,1943), date.mdy(3,17,1992), 'quarters') => -193.00 +datediff(date.mdy(3,17,1992), date.mdy(2,25,1996), 'quarters') => -15.00 +datediff(date.mdy(9,29,41), date.mdy(2,25,1996), 'quarters') => -217.00 +datediff(date.mdy(9,29,41), date.mdy(4,19,43), 'quarters') => -6.00 +datediff(date.mdy(4,19,43), date.mdy(10,7,43), 'quarters') => -1.00 +datediff(date.mdy(10,7,43), date.mdy(3,17,92), 'quarters') => -193.00 +datediff(date.mdy(3,17,92), date.mdy(2,25,96), 'quarters') => -15.00 +datediff(date.mdy(2,25,96), date.mdy(11,10,2038), 'quarters') => -170.00 +datediff(date.mdy(11,10,2038), date.mdy(7,18,2094), 'quarters') => -222.00 +datediff(date.mdy(2,29,1900), date.mdy(2,29,1904), 'quarters') => -15.00 +datediff(date.mdy(2,29,1904), date.mdy(2,29,1908), 'quarters') => -16.00 +datediff(date.mdy(2,29,1900), date.mdy(2,28,1903), 'quarters') => -11.00 + +datediff(date.mdy(6,10,1648), date.mdy(6,30,1680), 'months') => -384.00 +datediff(date.mdy(6,30,1680), date.mdy(7,24,1716), 'months') => -432.00 +datediff(date.mdy(7,24,1716), date.mdy(6,19,1768), 'months') => -622.00 +datediff(date.mdy(6,19,1768), date.mdy(8,2,1819), 'months') => -613.00 +datediff(date.mdy(8,2,1819), date.mdy(3,27,1839), 'months') => -235.00 +datediff(date.mdy(3,27,1839), date.mdy(4,19,1903), 'months') => -768.00 +datediff(date.mdy(4,19,1903), date.mdy(8,25,1929), 'months') => -316.00 +datediff(date.mdy(8,25,1929), date.mdy(9,29,1941), 'months') => -145.00 +datediff(date.mdy(9,29,1941), date.mdy(4,19,1943), 'months') => -18.00 +datediff(date.mdy(4,19,1943), date.mdy(10,7,1943), 'months') => -5.00 +datediff(date.mdy(10,7,1943), date.mdy(3,17,1992), 'months') => -581.00 +datediff(date.mdy(3,17,1992), date.mdy(2,25,1996), 'months') => -47.00 +datediff(date.mdy(9,29,41), date.mdy(2,25,1996), 'months') => -652.00 +datediff(date.mdy(9,29,41), date.mdy(4,19,43), 'months') => -18.00 +datediff(date.mdy(4,19,43), date.mdy(10,7,43), 'months') => -5.00 +datediff(date.mdy(10,7,43), date.mdy(3,17,92), 'months') => -581.00 +datediff(date.mdy(3,17,92), date.mdy(2,25,96), 'months') => -47.00 +datediff(date.mdy(2,25,96), date.mdy(11,10,2038), 'months') => -512.00 +datediff(date.mdy(11,10,2038), date.mdy(7,18,2094), 'months') => -668.00 +datediff(date.mdy(2,29,1900), date.mdy(2,29,1904), 'months') => -47.00 +datediff(date.mdy(2,29,1904), date.mdy(2,29,1908), 'months') => -48.00 +datediff(date.mdy(2,29,1900), date.mdy(2,28,1903), 'months') => -35.00 + +datediff(date.mdy(6,10,1648), date.mdy(6,30,1680), 'weeks') => -1672.00 +datediff(date.mdy(6,30,1680), date.mdy(7,24,1716), 'weeks') => -1881.00 +datediff(date.mdy(7,24,1716), date.mdy(6,19,1768), 'weeks') => -2708.00 +datediff(date.mdy(6,19,1768), date.mdy(8,2,1819), 'weeks') => -2667.00 +datediff(date.mdy(8,2,1819), date.mdy(3,27,1839), 'weeks') => -1025.00 +datediff(date.mdy(3,27,1839), date.mdy(4,19,1903), 'weeks') => -3342.00 +datediff(date.mdy(4,19,1903), date.mdy(8,25,1929), 'weeks') => -1375.00 +datediff(date.mdy(8,25,1929), date.mdy(9,29,1941), 'weeks') => -631.00 +datediff(date.mdy(9,29,1941), date.mdy(4,19,1943), 'weeks') => -81.00 +datediff(date.mdy(4,19,1943), date.mdy(10,7,1943), 'weeks') => -24.00 +datediff(date.mdy(10,7,1943), date.mdy(3,17,1992), 'weeks') => -2527.00 +datediff(date.mdy(3,17,1992), date.mdy(2,25,1996), 'weeks') => -205.00 +datediff(date.mdy(9,29,41), date.mdy(2,25,1996), 'weeks') => -2838.00 +datediff(date.mdy(9,29,41), date.mdy(4,19,43), 'weeks') => -81.00 +datediff(date.mdy(4,19,43), date.mdy(10,7,43), 'weeks') => -24.00 +datediff(date.mdy(10,7,43), date.mdy(3,17,92), 'weeks') => -2527.00 +datediff(date.mdy(3,17,92), date.mdy(2,25,96), 'weeks') => -205.00 +datediff(date.mdy(2,25,96), date.mdy(11,10,2038), 'weeks') => -2228.00 +datediff(date.mdy(11,10,2038), date.mdy(7,18,2094), 'weeks') => -2905.00 +datediff(date.mdy(2,29,1900), date.mdy(2,29,1904), 'weeks') => -208.00 +datediff(date.mdy(2,29,1904), date.mdy(2,29,1908), 'weeks') => -208.00 +datediff(date.mdy(2,29,1900), date.mdy(2,28,1903), 'weeks') => -156.00 + +datediff(date.mdy(6,10,1648), date.mdy(6,30,1680), 'days') => -11708.00 +datediff(date.mdy(6,30,1680), date.mdy(7,24,1716), 'days') => -13172.00 +datediff(date.mdy(7,24,1716), date.mdy(6,19,1768), 'days') => -18958.00 +datediff(date.mdy(6,19,1768), date.mdy(8,2,1819), 'days') => -18670.00 +datediff(date.mdy(8,2,1819), date.mdy(3,27,1839), 'days') => -7177.00 +datediff(date.mdy(3,27,1839), date.mdy(4,19,1903), 'days') => -23398.00 +datediff(date.mdy(4,19,1903), date.mdy(8,25,1929), 'days') => -9625.00 +datediff(date.mdy(8,25,1929), date.mdy(9,29,1941), 'days') => -4418.00 +datediff(date.mdy(9,29,1941), date.mdy(4,19,1943), 'days') => -567.00 +datediff(date.mdy(4,19,1943), date.mdy(10,7,1943), 'days') => -171.00 +datediff(date.mdy(10,7,1943), date.mdy(3,17,1992), 'days') => -17694.00 +datediff(date.mdy(3,17,1992), date.mdy(2,25,1996), 'days') => -1440.00 +datediff(date.mdy(9,29,41), date.mdy(2,25,1996), 'days') => -19872.00 +datediff(date.mdy(9,29,41), date.mdy(4,19,43), 'days') => -567.00 +datediff(date.mdy(4,19,43), date.mdy(10,7,43), 'days') => -171.00 +datediff(date.mdy(10,7,43), date.mdy(3,17,92), 'days') => -17694.00 +datediff(date.mdy(3,17,92), date.mdy(2,25,96), 'days') => -1440.00 +datediff(date.mdy(2,25,96), date.mdy(11,10,2038), 'days') => -15599.00 +datediff(date.mdy(11,10,2038), date.mdy(7,18,2094), 'days') => -20339.00 +datediff(date.mdy(2,29,1900), date.mdy(2,29,1904), 'days') => -1460.00 +datediff(date.mdy(2,29,1904), date.mdy(2,29,1908), 'days') => -1461.00 +datediff(date.mdy(2,29,1900), date.mdy(2,28,1903), 'days') => -1094.00 + +datediff(date.mdy(6,30,1680), date.mdy(6,10,1648), 'years') => 32.00 +datediff(date.mdy(7,24,1716), date.mdy(6,30,1680), 'years') => 36.00 +datediff(date.mdy(6,19,1768), date.mdy(7,24,1716), 'years') => 51.00 +datediff(date.mdy(8,2,1819), date.mdy(6,19,1768), 'years') => 51.00 +datediff(date.mdy(3,27,1839), date.mdy(8,2,1819), 'years') => 19.00 +datediff(date.mdy(4,19,1903), date.mdy(3,27,1839), 'years') => 64.00 +datediff(date.mdy(8,25,1929), date.mdy(4,19,1903), 'years') => 26.00 +datediff(date.mdy(9,29,1941), date.mdy(8,25,1929), 'years') => 12.00 +datediff(date.mdy(4,19,1943), date.mdy(9,29,1941), 'years') => 1.00 datediff(date.mdy(10,7,1943), date.mdy(4,19,1943), 'years') => 0.00 -datediff(date.mdy(3,17,1992), date.mdy(10,7,1943), 'years') => -48.00 -datediff(date.mdy(2,25,1996), date.mdy(3,17,1992), 'years') => -3.00 -datediff(date.mdy(2,25,1996), date.mdy(9,29,41), 'years') => -54.00 -datediff(date.mdy(4,19,43), date.mdy(9,29,41), 'years') => -1.00 +datediff(date.mdy(3,17,1992), date.mdy(10,7,1943), 'years') => 48.00 +datediff(date.mdy(2,25,1996), date.mdy(3,17,1992), 'years') => 3.00 +datediff(date.mdy(2,25,1996), date.mdy(9,29,41), 'years') => 54.00 +datediff(date.mdy(4,19,43), date.mdy(9,29,41), 'years') => 1.00 datediff(date.mdy(10,7,43), date.mdy(4,19,43), 'years') => 0.00 -datediff(date.mdy(3,17,92), date.mdy(10,7,43), 'years') => -48.00 -datediff(date.mdy(2,25,96), date.mdy(3,17,92), 'years') => -3.00 -datediff(date.mdy(11,10,2038), date.mdy(2,25,96), 'years') => -42.00 -datediff(date.mdy(7,18,2094), date.mdy(11,10,2038), 'years') => -55.00 -datediff(date.mdy(2,29,1904), date.mdy(2,29,1900), 'years') => -3.00 -datediff(date.mdy(2,29,1908), date.mdy(2,29,1904), 'years') => -4.00 -datediff(date.mdy(2,28,1903), date.mdy(2,29,1900), 'years') => -2.00 - -datediff(date.mdy(6,30,1680), date.mdy(6,10,1648), 'months') => -384.00 -datediff(date.mdy(7,24,1716), date.mdy(6,30,1680), 'months') => -432.00 -datediff(date.mdy(6,19,1768), date.mdy(7,24,1716), 'months') => -622.00 -datediff(date.mdy(8,2,1819), date.mdy(6,19,1768), 'months') => -613.00 -datediff(date.mdy(3,27,1839), date.mdy(8,2,1819), 'months') => -235.00 -datediff(date.mdy(4,19,1903), date.mdy(3,27,1839), 'months') => -768.00 -datediff(date.mdy(8,25,1929), date.mdy(4,19,1903), 'months') => -316.00 -datediff(date.mdy(9,29,1941), date.mdy(8,25,1929), 'months') => -145.00 -datediff(date.mdy(4,19,1943), date.mdy(9,29,1941), 'months') => -18.00 -datediff(date.mdy(10,7,1943), date.mdy(4,19,1943), 'months') => -5.00 -datediff(date.mdy(3,17,1992), date.mdy(10,7,1943), 'months') => -581.00 -datediff(date.mdy(2,25,1996), date.mdy(3,17,1992), 'months') => -47.00 -datediff(date.mdy(2,25,1996), date.mdy(9,29,41), 'months') => -652.00 -datediff(date.mdy(4,19,43), date.mdy(9,29,41), 'months') => -18.00 -datediff(date.mdy(10,7,43), date.mdy(4,19,43), 'months') => -5.00 -datediff(date.mdy(3,17,92), date.mdy(10,7,43), 'months') => -581.00 -datediff(date.mdy(2,25,96), date.mdy(3,17,92), 'months') => -47.00 -datediff(date.mdy(11,10,2038), date.mdy(2,25,96), 'months') => -512.00 -datediff(date.mdy(7,18,2094), date.mdy(11,10,2038), 'months') => -668.00 -datediff(date.mdy(2,29,1904), date.mdy(2,29,1900), 'months') => -47.00 -datediff(date.mdy(2,29,1908), date.mdy(2,29,1904), 'months') => -48.00 -datediff(date.mdy(2,28,1903), date.mdy(2,29,1900), 'months') => -35.00 - -datediff(date.mdy(6,30,1680), date.mdy(6,10,1648), 'quarters') => -128.00 -datediff(date.mdy(7,24,1716), date.mdy(6,30,1680), 'quarters') => -144.00 -datediff(date.mdy(6,19,1768), date.mdy(7,24,1716), 'quarters') => -207.00 -datediff(date.mdy(8,2,1819), date.mdy(6,19,1768), 'quarters') => -204.00 -datediff(date.mdy(3,27,1839), date.mdy(8,2,1819), 'quarters') => -78.00 -datediff(date.mdy(4,19,1903), date.mdy(3,27,1839), 'quarters') => -256.00 -datediff(date.mdy(8,25,1929), date.mdy(4,19,1903), 'quarters') => -105.00 -datediff(date.mdy(9,29,1941), date.mdy(8,25,1929), 'quarters') => -48.00 -datediff(date.mdy(4,19,1943), date.mdy(9,29,1941), 'quarters') => -6.00 -datediff(date.mdy(10,7,1943), date.mdy(4,19,1943), 'quarters') => -1.00 -datediff(date.mdy(3,17,1992), date.mdy(10,7,1943), 'quarters') => -193.00 -datediff(date.mdy(2,25,1996), date.mdy(3,17,1992), 'quarters') => -15.00 -datediff(date.mdy(2,25,1996), date.mdy(9,29,41), 'quarters') => -217.00 -datediff(date.mdy(4,19,43), date.mdy(9,29,41), 'quarters') => -6.00 -datediff(date.mdy(10,7,43), date.mdy(4,19,43), 'quarters') => -1.00 -datediff(date.mdy(3,17,92), date.mdy(10,7,43), 'quarters') => -193.00 -datediff(date.mdy(2,25,96), date.mdy(3,17,92), 'quarters') => -15.00 -datediff(date.mdy(11,10,2038), date.mdy(2,25,96), 'quarters') => -170.00 -datediff(date.mdy(7,18,2094), date.mdy(11,10,2038), 'quarters') => -222.00 -datediff(date.mdy(2,29,1904), date.mdy(2,29,1900), 'quarters') => -15.00 -datediff(date.mdy(2,29,1908), date.mdy(2,29,1904), 'quarters') => -16.00 -datediff(date.mdy(2,28,1903), date.mdy(2,29,1900), 'quarters') => -11.00 +datediff(date.mdy(3,17,92), date.mdy(10,7,43), 'years') => 48.00 +datediff(date.mdy(2,25,96), date.mdy(3,17,92), 'years') => 3.00 +datediff(date.mdy(11,10,2038), date.mdy(2,25,96), 'years') => 42.00 +datediff(date.mdy(7,18,2094), date.mdy(11,10,2038), 'years') => 55.00 +datediff(date.mdy(2,29,1904), date.mdy(2,29,1900), 'years') => 3.00 +datediff(date.mdy(2,29,1908), date.mdy(2,29,1904), 'years') => 4.00 +datediff(date.mdy(2,28,1903), date.mdy(2,29,1900), 'years') => 2.00 + +datediff(date.mdy(6,30,1680), date.mdy(6,10,1648), 'months') => 384.00 +datediff(date.mdy(7,24,1716), date.mdy(6,30,1680), 'months') => 432.00 +datediff(date.mdy(6,19,1768), date.mdy(7,24,1716), 'months') => 622.00 +datediff(date.mdy(8,2,1819), date.mdy(6,19,1768), 'months') => 613.00 +datediff(date.mdy(3,27,1839), date.mdy(8,2,1819), 'months') => 235.00 +datediff(date.mdy(4,19,1903), date.mdy(3,27,1839), 'months') => 768.00 +datediff(date.mdy(8,25,1929), date.mdy(4,19,1903), 'months') => 316.00 +datediff(date.mdy(9,29,1941), date.mdy(8,25,1929), 'months') => 145.00 +datediff(date.mdy(4,19,1943), date.mdy(9,29,1941), 'months') => 18.00 +datediff(date.mdy(10,7,1943), date.mdy(4,19,1943), 'months') => 5.00 +datediff(date.mdy(3,17,1992), date.mdy(10,7,1943), 'months') => 581.00 +datediff(date.mdy(2,25,1996), date.mdy(3,17,1992), 'months') => 47.00 +datediff(date.mdy(2,25,1996), date.mdy(9,29,41), 'months') => 652.00 +datediff(date.mdy(4,19,43), date.mdy(9,29,41), 'months') => 18.00 +datediff(date.mdy(10,7,43), date.mdy(4,19,43), 'months') => 5.00 +datediff(date.mdy(3,17,92), date.mdy(10,7,43), 'months') => 581.00 +datediff(date.mdy(2,25,96), date.mdy(3,17,92), 'months') => 47.00 +datediff(date.mdy(11,10,2038), date.mdy(2,25,96), 'months') => 512.00 +datediff(date.mdy(7,18,2094), date.mdy(11,10,2038), 'months') => 668.00 +datediff(date.mdy(2,29,1904), date.mdy(2,29,1900), 'months') => 47.00 +datediff(date.mdy(2,29,1908), date.mdy(2,29,1904), 'months') => 48.00 +datediff(date.mdy(2,28,1903), date.mdy(2,29,1900), 'months') => 35.00 + +datediff(date.mdy(6,30,1680), date.mdy(6,10,1648), 'quarters') => 128.00 +datediff(date.mdy(7,24,1716), date.mdy(6,30,1680), 'quarters') => 144.00 +datediff(date.mdy(6,19,1768), date.mdy(7,24,1716), 'quarters') => 207.00 +datediff(date.mdy(8,2,1819), date.mdy(6,19,1768), 'quarters') => 204.00 +datediff(date.mdy(3,27,1839), date.mdy(8,2,1819), 'quarters') => 78.00 +datediff(date.mdy(4,19,1903), date.mdy(3,27,1839), 'quarters') => 256.00 +datediff(date.mdy(8,25,1929), date.mdy(4,19,1903), 'quarters') => 105.00 +datediff(date.mdy(9,29,1941), date.mdy(8,25,1929), 'quarters') => 48.00 +datediff(date.mdy(4,19,1943), date.mdy(9,29,1941), 'quarters') => 6.00 +datediff(date.mdy(10,7,1943), date.mdy(4,19,1943), 'quarters') => 1.00 +datediff(date.mdy(3,17,1992), date.mdy(10,7,1943), 'quarters') => 193.00 +datediff(date.mdy(2,25,1996), date.mdy(3,17,1992), 'quarters') => 15.00 +datediff(date.mdy(2,25,1996), date.mdy(9,29,41), 'quarters') => 217.00 +datediff(date.mdy(4,19,43), date.mdy(9,29,41), 'quarters') => 6.00 +datediff(date.mdy(10,7,43), date.mdy(4,19,43), 'quarters') => 1.00 +datediff(date.mdy(3,17,92), date.mdy(10,7,43), 'quarters') => 193.00 +datediff(date.mdy(2,25,96), date.mdy(3,17,92), 'quarters') => 15.00 +datediff(date.mdy(11,10,2038), date.mdy(2,25,96), 'quarters') => 170.00 +datediff(date.mdy(7,18,2094), date.mdy(11,10,2038), 'quarters') => 222.00 +datediff(date.mdy(2,29,1904), date.mdy(2,29,1900), 'quarters') => 15.00 +datediff(date.mdy(2,29,1908), date.mdy(2,29,1904), 'quarters') => 16.00 +datediff(date.mdy(2,28,1903), date.mdy(2,29,1900), 'quarters') => 11.00 # DATESUM with non-leap year ctime.days(datesum(date.mdy(1,31,1900), 1, 'months') - date.mdy(1,1,1900)) => 58.00 -- 2.30.2