I am looking to calculate the time difference between a start and an end time. It works ok, but not so much when the times expand over midnight (for example, my start time is 11:30pm, and end time is 12:15am the next day), my length should be 45 minutes but instead is a negative number. Is there a way I can account for this?
I only have the 2 time stamps and did the following define:
Length/D12.2 = HDIFF(FACT_OR.FACT_OR.End_time, FACT_OR.FACT_OR.Start_time, 'MINUTE', 'D9');This message has been edited. Last edited by: <Emily McAllister>,
8.0.0.2 Windows, All Outputs
February 23, 2016, 12:28 PM
Francis Mariani
Does START_TIME not have a date portion?
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
February 23, 2016, 12:41 PM
hfung1
Hi
I do have a date field that I did not use, but it would only apply to the start date as that date field shows just the date for the start time, I do not have an "end date" field for the end time
8.0.0.2 Windows, All Outputs
February 23, 2016, 01:08 PM
Tony A
Have you searched on "time difference"?
Lot's of posts going way back to 2005 that will give you lot's of ideas and knowledge on how to achieve this.
Good luck
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
February 23, 2016, 01:14 PM
BabakNYC
quote:
I do not have an "end date" field for the end time
If you don't have the END DATE/TIME how would you know if the end was the next day at 12:30AM or next month? Are there assumptions you can make about how long the difference can be?
WebFOCUS 8206, Unix, Windows
February 23, 2016, 01:43 PM
hfung1
Hi,
Yes it is safe to assume none of the times would be beyond the next day for example the next month, all the lengths are within 3-4 hours of each other. So pretty much...this is only applying to anything that was in the late 20s of the 24 hour clock for the start time and then the 0 or 1 hours for the end time
8.0.0.2 Windows, All Outputs
February 23, 2016, 02:35 PM
RSquared
Hi,
Have you tried checking to see if the end time is less than the begin time ? If yes add 1440 minutes to the end time and calculate the difference.
WF 7.6.11 Oracle WebSphere Windows NT-5.2 x86 32bit