cancel
Showing results for 
Search instead for 
Did you mean: 

timeserial not returning correct time

Former Member
0 Kudos

Hi All,

I am using the timeserial funcation to return a time format for my numbervar.

whileprintingrecords;

global numbervar shifttimert;

timeserial(0,0,shifttimert);

shifttimert = 236616 which should be 65 hours appr. The serial time the formula returns is 17:43:36.

Why is the timeserial function not returning the correct time? Is the number too large?

Thank you in advance.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member260594
Active Contributor
0 Kudos

Antoine,

TimeSerial will return a time based on the 24 hour clock. So 65/24 = 2 days and 17 hours. As it can only output a time and not days it displays the remainder which is 17

Former Member
0 Kudos

Thank you for that Graham. I guess it only worked for me as it was under 24 hours. However, I did manage to solve my problem with the following code:

stringvar minutes;

stringvar seconds;

numberVar M:=(Remainder(Truncate (/(60)),60)); numberVar S:=(Remainder(Truncate (),60));

if(M<10)then

minutes:="0"&totext(M)

else

minutes:=totext(M);

if(S<10)then

seconds:="0"&totext(S)

else

seconds:=totext(S);

CStr(int(Truncate(/(60*60))),"##") & ":" &minutes&":"&seconds;

That returns the hh:mm:ss that I was looking for.

Former Member
0 Kudos

Hi

Would suggest you to refer to the syntax of timeserial() function from Crystal Reports help.

Regards

Sourashree