Crystal Reports: ElapsedTime() Function

Converts a number of seconds into a string in the format of days.hours:minutes:seconds.

Function (NumberVar interval)
NumberVar Days := Truncate(interval / 86400);
NumberVar Hours := Truncate(Remainder(interval, 86400) / 3600);
NumberVar Minutes := Truncate(Remainder(interval, 3600) / 60);
NumberVar Seconds := Remainder(interval, 60);
Totext(Days,'##') +'.'+ Totext(Hours,'00') +':'+ Totext(Minutes,'00') +':'+ Totext(Seconds,'00')


The number of seconds to be converted.

Return Value

A string in the format of days.hours:minutes:seconds




//returns 0.00:02:12

//formats the difference between two datetime values.
ElapsedTime ((CurrentDateTime-DateTime(2006,1,1,0,0,0))*86400)

//formats the difference between two datetime values.
ElapsedTime (DateDiff("s", {TABLE.FIELD}, CurrentDateTime))


This function requires the use of Crystal Syntax.

One thought on “Crystal Reports: ElapsedTime() Function

  1. DR

    I couldnt get the function to work;
    but it gave me the direction to get the formula to work as part of a formula field in the footer.
    Ya have to wonder why this isnt a default part of all programming programs. Many Thanx! I really needed this!

Leave a Reply

Your email address will not be published. Required fields are marked *