To: Paul Kavanagh
Subject: How Many Days Since 1900?
On Tue, 14 Sep 1999, Paul Kavanagh wrote:
> Ari,
> I just wanted to complement your website, 
> and I had a question on an SQL problem,  My apologises if I'm bothering you,
> Im trying to select back how many days have passed since the year 1900,
> I know of the months_betwee function  but is there any other way I can select
> back the days other than doing the following whereby Im guessing the days
> SELECT TO_CHAR(sysdate - 36414,'dd-mon-yyyy hh:mi:ss am') Todays_date FROM
> dual
> will give you back 01-JAN-99 
> so its been 36,414 days since 1900,  
> I would be grateful if you could help me out,
> and again please accept my apologises if I am pestering you
> regards
> Paul
To find out the number of days since 1900, you can do a few things:
1) select sysdate-to_date('01/01/1900') from dual;
2) select to_char(sysdate,'J') - to_char('01/01/1900','J') from dual;
The 'J' above converts the date to the number of days since December 31,
4713 B.C.E.
Best regards,
-Ari Kaplan
Independent Oracle DBA Consultant
<-> For 335+ Oracle tips, visit my Web Page:                      <->
<->                                                               <->
<->                             <->
<->                                                               <->
<->             email:                    <->
Note: From ponnusws@WellsFargo.COM:
Hi Ari
I was going through the Oracle Tips in you website and it was tremendous.
For Tip Number 371 (How many days Since 1900), your answer had some syntax
error.   If you update the WEBSITE with the proper syntax, it will be
appreciated.  Following are the answers for that query and I have tested it,
it works fine.
select sysdate - to_date('01/01/1900','DD/MM/YYYY') from dual;
select to_char(sysdate,'J') -
to_char(to_date('01/01/1900','DD/MM/YYYY'),'J') from dual;

Back to Ari Kaplan's Home Page">Back to Ari Kaplan's Home Page