To All Crystal Experts:
Need some help please! The following formula I have is based on a forum post, which is pretty close to what I require, however, I just cannot seem to get it quite right. I did make some minor changes from the original post to suit my needs. Any help would be much appreciated, as I am not a very good programmer.
Here is the situation. I have a forumla that calculates the number of seconds, based on the total time. For example, my formula {@Session Time} might yield a numberic equal to 12720 (this is the number of seconds I would like to convert to hours, minutes, seconds). The end result I would like to see is 3 hours 32 minutes. However, this is what I am receiving: 3 hours 1,920 minutes (it is not converting to minutes...it is still in seconds). Here is the formula I am using:
------------- BEGIN HERE ----------------
Numbervar session_time_in_seconds:={@Session Time};
Stringvar hours_spent:='';
Stringvar minutes_spent:='';
Stringvar seconds_spent:='';
Stringvar time_spent:='';
If session_time_in_seconds>60*60 then
hours_spent:=totext(truncate(session_time_in_seconds/(60*60)),0)+' hour'+ if truncate(session_time_in_seconds/(60*60))>1 then 's ' else ' '
Else
hours_spent:='';
If session_time_in_seconds>60 then
If session_time_in_seconds>(60*60) then
minutes_spent:=totext(remainder((session_time_in_seconds),(60*60)),0)+' minute'+ if remainder((session_time_in_seconds),(60*60))>1 then 's ' else ' '
Else
minutes_spent:=totext(truncate((session_time_in_seconds)/(60)),0)+' minute'+ if truncate((session_time_in_seconds)/(60))>1 then 's' else ' '
Else
minutes_spent:='';
If session_time_in_seconds>60 then
seconds_spent:=totext(remainder(session_time_in_seconds,60),0)+' second'+ if remainder(session_time_in_seconds,60)>1 then 's' else ''
Else
seconds_spent:=totext(session_time_in_seconds,0)+' second'+ if session_time_in_seconds>1 then 's' else '';
Time_spent:=hours_spent+minutes_spent+seconds_spent
------------- END HERE -----------------
Any thoughts on how one can fix the minutes into seconds? I believe it just has to be divided by 60, but I am not sure where to or how to do this...thank you in advance.
Need some help please! The following formula I have is based on a forum post, which is pretty close to what I require, however, I just cannot seem to get it quite right. I did make some minor changes from the original post to suit my needs. Any help would be much appreciated, as I am not a very good programmer.
Here is the situation. I have a forumla that calculates the number of seconds, based on the total time. For example, my formula {@Session Time} might yield a numberic equal to 12720 (this is the number of seconds I would like to convert to hours, minutes, seconds). The end result I would like to see is 3 hours 32 minutes. However, this is what I am receiving: 3 hours 1,920 minutes (it is not converting to minutes...it is still in seconds). Here is the formula I am using:
------------- BEGIN HERE ----------------
Numbervar session_time_in_seconds:={@Session Time};
Stringvar hours_spent:='';
Stringvar minutes_spent:='';
Stringvar seconds_spent:='';
Stringvar time_spent:='';
If session_time_in_seconds>60*60 then
hours_spent:=totext(truncate(session_time_in_seconds/(60*60)),0)+' hour'+ if truncate(session_time_in_seconds/(60*60))>1 then 's ' else ' '
Else
hours_spent:='';
If session_time_in_seconds>60 then
If session_time_in_seconds>(60*60) then
minutes_spent:=totext(remainder((session_time_in_seconds),(60*60)),0)+' minute'+ if remainder((session_time_in_seconds),(60*60))>1 then 's ' else ' '
Else
minutes_spent:=totext(truncate((session_time_in_seconds)/(60)),0)+' minute'+ if truncate((session_time_in_seconds)/(60))>1 then 's' else ' '
Else
minutes_spent:='';
If session_time_in_seconds>60 then
seconds_spent:=totext(remainder(session_time_in_seconds,60),0)+' second'+ if remainder(session_time_in_seconds,60)>1 then 's' else ''
Else
seconds_spent:=totext(session_time_in_seconds,0)+' second'+ if session_time_in_seconds>1 then 's' else '';
Time_spent:=hours_spent+minutes_spent+seconds_spent
------------- END HERE -----------------
Any thoughts on how one can fix the minutes into seconds? I believe it just has to be divided by 60, but I am not sure where to or how to do this...thank you in advance.