Reputation: 78
I have a numeric field in my Oracle database that represents the number of days since Dec 28, 1800. However I am trying to select it (for another application) as the current date it represents. I'm not too familiar with Oracle commands (I'm used to SQL), so I was wondering if anyone could provide some assistance. Thanks.
ex: 77650 = Saturday, August 3, 2013
Upvotes: 3
Views: 8582
Reputation: 52853
Firstly, get this out of the way, your life would be easier if you stored dates in a date data-type.
However, to answer your question to add days to a date in Oracle you can use the +
operator.
Firstly though you have to have a date so I'll convert the 28th December 1800 into a date using to inbuilt to_date
function then add the number. In your case you would want:
select to_date('1800/12/28','yyyy/mm/dd') + 77650 from dual
I've set up a little SQL Fiddle to demonstrate for you.
Upvotes: 5