*DURATION performs the following operation:
End date - Start date = Duration
The *DURATION function result is often not as obvious and easily predictable as the *DATE INCREMENT result. For example, what is the duration expressed in *MONTHS between Start date (December 31, 1995) and End date (February 29, 1996)? The function returns two months even though three months are involved in the calculation. This is another example of the Everyday calendar’s approximation.
The remainder of this section gives examples of specific assumptions CA 2E makes to adjust results to common sense standards and to produce consistent results.
|
Start date |
End date |
Duration |
Actual Days |
|---|---|---|---|
|
December 31, 1995 |
January 31, 1996 |
1 (*MONTHS) |
31 |
|
December 19, 1995 |
January 23, 1996 |
1 (*MONTHS) |
35 |
|
December 28, 1995 |
January 23, 1996 |
0 (*MONTHS) |
26 |
|
January 31, 1996 |
February 29, 1996 |
1 (*MONTHS) |
29 |
|
Start date |
End date |
Duration |
Actual Days |
|---|---|---|---|
|
December 31, 1995 |
December 31, 1996 |
1 (*YEARS) |
365 |
|
December 31, 1996 |
December 31, 1997 |
1 (*YEARS) |
365 |
|
June 30, 1996 |
June 30, 1997 |
1 (*YEARS) |
365 |
|
Start date |
End date |
Duration |
Actual Days |
|---|---|---|---|
|
November 12, 1995 |
March 23, 1997 |
1 (*YEARS) |
497 |
|
November 12, 1995 |
March 23, 1997 |
16 (*MONTHS) |
497 |
|
November 12, 1995 |
March 23, 1997 |
104 (*YYMM) |
497 |
|
November 12, 1995 |
March 23, 1997 |
10410 (*YYMMDD) |
497 |
Following are the steps used to produce this result.
Recall that the DD portion of the *YYMMDD duration type represents the number of days not included in either the Duration year (YY) or the Duration month (MM). In other words, Remainder days (DD) – Duration month = 10 days (41 – 31 = 10).
The final result in *YYMMDD format is 10410.
|
Start date |
End date |
Duration |
Actual Days |
|---|---|---|---|
|
December 1, 1995 |
January 1, 1996 |
100 |
31 |
|
January 1, 1996 |
December 1, 1995 |
–100 |
–31 |
|
February 12, 1995 |
March 12, 1995 |
100 |
28 |
|
February 12, 1996 |
March 12, 1996 |
100 |
29 |
Application of this rule sometimes causes different, but close, Start and End dates to return the same duration.
|
Start date |
End date |
Duration |
Actual Days |
|---|---|---|---|
|
May 19, 1996 |
June 20, 1996 |
102 |
32 |
|
May 20, 1996 |
June 20, 1996 |
100 (2) |
31 |
|
May 21, 1996 |
June 20, 1996 |
100 |
30 |
|
May 22, 1996 |
June 20, 1996 |
029 |
29 |
|
(1) The End month, June, has 30 days; so the Duration month |
|||
|
Start date |
End date |
Duration |
Actual Days |
|---|---|---|---|
|
December 8, 1995 |
December 8, 1996 |
10000 |
366 |
|
February 1, 1995 |
February 1, 1996 |
10000 |
365 |
|
February 1, 1996 |
February 1, 1995 |
–10000 |
–365 |
Application of this rule sometimes causes different, but close, Start and End dates to return the same duration.
|
Start date |
End date |
Duration |
Actual Days |
|---|---|---|---|
|
February 28, 1995 |
February 29, 1996 |
10000 |
366 |
|
February 28, 1995 |
February 28, 1996 |
10000 (1) |
365 |
|
(1) This result was adjusted since the Start and End dates represent the same day and month in contiguous years. |
|||
| Copyright © 2011 CA. All rights reserved. | Tell Technical Publications how we can improve this information |