Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Seconds to HH:MM:SS /Crosstab Summary Post Reply Post New Topic
Author Message
NCGOV
Newbie
Newbie
Avatar

Joined: 04 Oct 2016
Online Status: Offline
Posts: 24
Quote NCGOV Replybullet Topic: Seconds to HH:MM:SS /Crosstab Summary
    Posted: 03 May 2017 at 4:46am
Does anyone have a way to convert seconds to HH:MM:SS that will allow the time to be summarized in a crosstab?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 03 May 2017 at 8:19am
I would rethink your request a bit.
leaving it as total seconds is easier to summarize.
You can add a display as over the top of that if you need to. Trying to summarize a display string of "hh:nn:ss" won't make much sense. Keeping it as a standard integer like total seconds would.
Also what happens if the total hours goes over 24? Does this also need to display one day + the time?


Edited by DBlank - 03 May 2017 at 8:19am
IP IP Logged
NCGOV
Newbie
Newbie
Avatar

Joined: 04 Oct 2016
Online Status: Offline
Posts: 24
Quote NCGOV Replybullet Posted: 03 May 2017 at 8:27am
Thank you for the feedback.

I used the following formula in the display sting under the common tab -

local numbervar RemainingSeconds;
local numbervar Hours ;
local numbervar Minutes;
local numbervar Seconds;

Hours:=truncate(currentfieldvalue/3600);
RemainingSeconds:= currentfieldvalue - (Hours*3600);
Minutes:=truncate(RemainingSeconds/60);
Seconds:=currentfieldvalue - (Hours *3600)-(Minutes*60);

Totext (Hours, "00") + ":" + totext(Minutes, "00") + ":" + totext(Seconds, "00")
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 03 May 2017 at 8:50am
Yes that is one way, assuming you never go over 99 hours. Again this is returning a string that is not really something you can summarize.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.