Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hours between two dates

Status
Not open for further replies.

pquintan

Programmer
Jul 25, 2001
2
ES
Hi,
I need to show how many hours and minutes are between two dates. Is this possible?

And what about this with working hours? Let's say that I just want to take into account time spent between 08:00 and 17:00.

 
Does your date measure contain details of time? eg DD/MM/YYYY HH:MM:SS

If not, try applying the function DayNumberOfYear() to your date measure, then subtract one date from the other and multiply by 24. This will give you the number of hours between two dates.
 
Hi,
My date is of the type DD/MM/YY HH:NN:SS. But when I substract one from the other doesn't work.

I have used the DateDiff()function :

DateDiff("s",db1.open_time,db1.close_time )

and this gave me the number of seconds of difference. Then, "playing" with this I can obtain the exact number of hours/minutes/seconds between dates. But it is quite complicated!!
 
Hi pquintan,

It looks like you use the function DateDiff("s",db1.open_time,db1.close_time )at the SQL level.
This function doesn't exist in the BO reporter.

You will maybe find a solution on a "SQL" forum. Search SQL on the forum list and choose the one in relation with your database (Sybase, Oracle, IBM,...)

My thinking about that is that you can be happy that your database gives your this kind of function: DateDiff(,,,).

Hope it will help.

GKar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top