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!

How to get mins

Status
Not open for further replies.

nikol

Programmer
Apr 12, 2005
126
US
Hi,
I have start_date & end_date columns. I used
dateDiff ("h", {start_date}, {end_date}) to get the hours.
Its giving 4.00 hrs
3.00 hrs.Truncating the mins.
I'm trying to use "mins/60" to get whole hrs & mins also.
Is there any other way I can do.
 
Hello...
You didn't mention what version of Crystal you are using but this may help...
if you use "n" instead of "h" it will give you the minutes...dateDiff ("h", {start_date}, {end_date})
Once you have the total minutes you can divide by 60 to get the hours...
Once you have the total hours in minutes you can subtract this number from the first number to get the leftover minutes...
So...

First formula: @TotalMins
Code:
dateDiff ("h", {start_date}, {end_date})

Second formula: @CalcHours
Code:
({@TotalMins})/60
//you may also have to use a function to drop everything after the "."

Third formula: @CalcMins
Code:
({@TotalMins}) - ({@CalcHours} * 60)

Fourth formula: @TotalHoursMins
Code:
{@CalcHours}&"hours and"&{@CalcMins}&"minutes"
//you can change this concatenation to whatever format you desire...just make sure to use "&" not "+"

Hope this helps!
B~


Boni J. Rychener
Hammerman Associates, Inc.
Crystal Training and Crystal Material
On-site and public classes
Low-cost telephone/email support
FREE independent Crystal newsletter
800-783-2269
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top