Print Page | Close Window

How to convert datediff from minutes to hh:mm

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=10279
Printed Date: 03 May 2024 at 12:59am


Topic: How to convert datediff from minutes to hh:mm
Posted By: flanman
Subject: How to convert datediff from minutes to hh:mm
Date Posted: 16 Jun 2010 at 11:03am
I have are report with shift start and end times. I have a formula giving me the difference in minutes like this.

Datediff("n",StartTime,EndTime)

Which gives me the minutes.

But if I try to /60 I am getting rounded numbers
I also tried using "h" in the datediff and got the same results

Example
1:30 pm       4:00 pm     I am getting 3.0 for the hours difference.

What I am trying to get as the result is 2:30 for the time difference.

Any help is always appeciated.




Replies:
Posted By: DBlank
Date Posted: 16 Jun 2010 at 11:36am
try
time({table.starttime} - {table.endtime})
then format the resulting formula field to use the "13:23" format option
 
 
...As long as you do not have any result minutes > 24 hours


Posted By: flanman
Date Posted: 16 Jun 2010 at 4:26pm
Once again thank you for a simple solution.



Print Page | Close Window