Use this function to determine the number of days difference between two dates and enter that value.
DiffDate (Date1, Format1, Date2, Format2)
Parameter |
Description |
Date1 |
Enter a date string. The system assumes this date string is in the format specified by the Format1 parameter. The default is the current date. |
Format1 |
Enter a date format string that describes the Date1 parameter. The default is date format 1 (MM/DD?YY). |
Date2 |
Enter a date string. The system assumes this date string is in the format specified by the Format2 parameter. The default is the current date. |
Format2 |
Enter a date format string that describes the Date2 parameter. The default is date format 1. |
The system returns a positive value if the first date is earlier than the second date. The result is negative if the first date is later than the second date. Use the DiffDate function when the chronological order of the dates is important.
Here are some examples:
(Assume the current date is 07/01/95.)
Function |
Result |
Explanation |
DiffDate ("7/15/95") |
-14 |
The second parameter defaults to the current date. The resulting difference in days is -14, because date1 is later in time than the current date. |
DiffDate ("06/01/95", "1") |
30 |
Note that the result is positive because the first date is earlier than the current date. |
DiffDate ("October 31, 1961", "4", "10/31/95", "1") |
12418 |
Note that two different date formats are used. |
© Copyright 2014, Oracle and/or its affiliates. All rights reserved. Legal notices.