Home » Other » Test » Date and Time Calculation (Oracle, SQL*Plus: Release 8.0.6.0.0, XP)
Date and Time Calculation [message #511219] Fri, 10 June 2011 04:03 Go to next message
myclassic
Messages: 136
Registered: December 2006
Location: Pakistan
Senior Member
T1 = 06-Jun-2011 4:00PM
T2 = 10-Jun-2011 11:AM

Calculation is Required.

If at the end of Day Hours of T1 > 6 hours then it should calculate 1 Day.

same with T2. hours of T2(from begining of Day till end Time (11AM), it should again caculate if >6 hours then 1 Day.

remaining will be date calculation.
this is how T2 - T1 should give us 5 Days.

Detail
06-Jun-2011 4:00PM to 06-Jun-2011 12:00AM (8 hours > 6 = 1 Day)
06-Jun-2011 12:00AM to 07-Jun-2011 12:00AM = (1 Day)
07-Jun-2011 12:00AM to 08-Jun-2011 12:00AM = (1 Day)
08-Jun-2011 12:00AM to 09-Jun-2011 12:00AM = (1 Day)
09-Jun-2011 12:00AM to 10-Jun-2011 12:00AM = (1 Day)
10-Jun-2011 12:00AM to 10-Jun-2011 11:00AM (11 hrs > 6 = 1 Day)

this is how 5Days calculation is required.
Any help is welcome.
Regards
Re: Date and Time Calculation [message #511235 is a reply to message #511219] Fri, 10 June 2011 05:49 Go to previous message
Michel Cadot
Messages: 67374
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version, with 4 decimals.

For such question, also Post a working Test case: create table and insert statements along with the result you want with these data then we will be able work with your table and data. Explain with words and sentences the rules that lead to this result.

Note that this forum is to test your post and not to get an actual answer.

Regards
Michel
Previous Topic: I see dead smilies
Next Topic: refcr
Goto Forum:
  


Current Time: Tue Sep 29 20:00:58 CDT 2020