Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 848473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:56:50+00:00 2026-05-15T06:56:50+00:00

Is there any oracle functions which will return the number of days between two

  • 0

Is there any oracle functions which will return the number of days between two dates like days360 function in excel?


DAYS360 :
“Returns the number of days between two dates based on a 360-day year (twelve 30-day months), which is used in some accounting calculations. Use this function to help compute payments if your accounting system is based on twelve 30-day months.

If the starting date is the last day of a month, it becomes equal to the 30th of the same month. If the ending date is the last day of a month and the starting date is earlier than the 30th of a month, the ending date becomes equal to the 1st of the next month; otherwise the ending date becomes equal to the 30th of the same month.”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T06:56:51+00:00Added an answer on May 15, 2026 at 6:56 am

    In Oracle we can do simple arithmetic on dates. Alternatively, we can turn the difference into an INTERVAL datatype:

    SQL> select id
      2         , start_date
      3         , end_date
      4         , (end_date - start_date) as arith_diff
      5         , (end_date - start_date) DAY TO SECOND as ds_interval
      6  from t42
      7  /
    
    
        ID START_DATE           END_DATE             ARITH_DIFF DS_INTERVAL
    ------ -------------------- -------------------- ---------- --------------------
       111 11-FEB-2010 05:44:52 01-MAR-2010 08:10:18 18.1009954 +18 02:25:26.000000
       222 15-APR-2010 10:50:46 19-MAY-2010 01:44:08 33.6203935 +33 14:53:22.000000
       333 01-JUN-2010 00:00:00 31-AUG-2010 00:00:00         91 +91 00:00:00.000000
       444 11-FEB-2010 00:00:00 01-MAR-2010 00:00:00         18 +18 00:00:00.000000
    
    SQL>
    

    edit

    “in days360 function it returns 20. in
    ur code it is 18.10. what i want is a
    function which should work exactly
    like days360”

    Okay, the Excel function days360() calculates the difference between two dates based on a year of twelve thirty-day months. There is no Oracle built-in which does this. Phil Singer has written his own PL/SQL implementation of this: find it here. Also be sure to read his follow-up piece. Certainly Phil’s function does give the results you want:

    SQL> select id
      2         , start_date
      3         , end_date
      4         , days360(start_date, end_date) as days360
      5  from t42
      6  /
    
            ID START_DATE           END_DATE                DAYS360
    ---------- -------------------- -------------------- ----------
           111 11-FEB-2010 05:44:52 01-MAR-2010 08:10:18         20
           222 15-APR-2010 10:50:46 19-MAY-2010 01:44:08         34
           333 01-JUN-2010 00:00:00 31-AUG-2010 00:00:00         90
           444 11-FEB-2010 00:00:00 01-MAR-2010 00:00:00         20
    
    SQL>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there any good oracle podcasts around? The only ones I've found is produced
is there any way in Oracle, to get only the dd-mm-yyyy part from an
Is there any way to listen to an Oracle AQ using a Perl process
Are there any optimizations to consider when connecting to Oracle with NHibernate? My calls
Is there any way to get around the Oracle 10g limitation of 1000 items
is there any problem to install different oracle 11g versions. I mean if I
I want to migrate schema from Oracle to MySQl, so are there any free
What is the string concatenation operator in Oracle SQL? Are there any interesting features
I'm seeing conflicting references in Oracles documentation . Is there any difference between how
Is there any method has the functionality of an IF-THEN-ELSE statement in java like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.