Reputation: 83
I have a question regarding the way that oracle does arithmetic on dates (connecting to 10g database). Given the following query:
select DateX - DateY as Number_Of_Days from table
my experience has led me to believe that oracle would return the number of days difference between the two dates (if DateX was earlier than DateY a negative # of days would be returned).
For most records being returned by my query, this is true. However, I have a single record in my dataset where DateX = 19-JUN-08 and DateY = 19-MAY-08 and the subtraction of those two = 365268.
Any ideas?
Upvotes: 2
Views: 140
Reputation: 16007
I'll take a stab at it. I think you actually have May 19th, 1008 as your other date.
WolframAlpha.com gives the difference from May 19th, 1008 to June 19th, 2008 as 365,274 days. However, there are some odd days in there. The years 1100, 1300, 1400, 1500, 1700, 1800, and 1900 were not leap years. That's a difference of seven days, which is almost where you need to be.
Upvotes: 4