[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.8

Obtaining date difference (interval?) in Years, Months, Days instead of just days or months (plus fractions)

Asked by bertbear in Oracle Product Info

Tags: date, difference, oracle, days, years

Hello,

I need to present date differences (interval?) in years, months, and days instead of just days.  I'm looking to do this in simple SQL (instead of Java, PL/SQL, etc.) on the other hand I'm open to all suggestions.

The two dates may both change (e.g. two different dates from the same row or different rows/tables), one may change while the other stays the same, or well, they might both from two places and don't change.  I looked for Oracle functions but the best I can find is months_between.  This still doesn't help as I need it to be people friendly (e.g. years, months, and days).

The dates are all truncated (e.g. trunc(sysdate)) so the hours, minutes, seconds, hundredths of a second, etc., are not an issue.  A future (e.g. 2004 or 2005) project might include the hours and the time difference between say January 23, 1968 at 20:31 and May 12, 2006 at 11:06 might be necessary.  Today, though, only the difference (in Years, Months, and Days) between say January 12, 1475 and December 1, 3006 is necessary. (Again the two dates may both change (e.g. different dates from the same row) when running a table of people (to show their age or when something they own expires.)

I'm giving this 95 points (while it isn't all I have) it is over half of them.  I noticed the point value chart says 125 is a not important question but moderately difficult.  Sorry, if 95 points isn't a lot, but I hope someone will work on this as it has me stumped.  There are so many date rules about leap year, century leap years, changes in the calendar, 1,000 year leap year rules, etc.  I have some ideas and have had some moderate success, but nothing to take care of the many situations of years and tables.

I also did a Google search but didn't really find anything along this line.  Thanks for you help.


P.S.  Here are some examples using April 18, 2003 as the later of the two dates:

117 Years     11 Months     16 Days - May       02, 1885 A.D.

0 Years          2 Months     25 Days - January   24, 2003 A.D.

399 Years     5 Months     6 Days - November  12, 1603 A.D.

278 Years     3 Months     1 Days - January   17, 1725 A.D.

226 Years     9 Months     14 Days - July      04, 1776 A.D.

938 Years     3 Months     17 Days - January   01, 1065 A.D.

3778 Years     9 Months     14 Days - July      04, 1776 B.C.
[+][-]04/18/03 06:43 PM, ID: 8357221Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Oracle Product Info
Tags: date, difference, oracle, days, years
Sign Up Now!
Solution Provided By: bmoshier
Participating Experts: 2
Solution Grade: A
 
[+][-]04/21/03 07:16 AM, ID: 8366726Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/21/03 12:07 PM, ID: 8368544Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/22/03 12:31 PM, ID: 8375759Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/22/03 02:40 PM, ID: 8376570Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/22/03 02:42 PM, ID: 8376590Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/23/03 02:45 AM, ID: 8378838Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92