ۥ-1@ -  # CCCC O Y CcB4 Crystal Reports Technical Document Subject: Converting a seconds displayed in CR to a 24 hour format Date: November 16, 1993 Versions: CRW for VB, or 2.0 Pro upgrades from VB Situation: When a time is displayed in seconds on a report, how do you convert it to the 24 hour format. Solution: Insert a formula field into your report using the following formula: // Ensuring that the time in seconds is not greater than 23:59:59 in 24 hour time, and //converting it if the number is found to be greater. NumberVar TotSeconds := ToNumber({Customer Table2.Time}); If TotSeconds > 86399 Then TotSeconds:= TotSeconds - 86399 Else TotSeconds:= TotSeconds; // Extracting the hours from a time field displayed in seconds. NumberVar Hours; NumberVar Tothours:= TotSeconds; If Tothours / 3600 > 0 Then Hours:= Truncate(Tothours / 3600) Else Hours:=0; NumberVar Totmins:= Tothours - (Hours * 3600); // Extracing the minutes from a time field displayed in seconds. NumberVar Mins; If Totmins / 60 > 0 Then Mins:= Truncate(Totmins / 60) Else Mins:= 0; // Extracting the seconds from a 24 hour time displayed in seconds. NumberVar Secs:= (Totmins - (Mins * 60)); // Placing a leading zero for hours less than ten If Hours < 10 Then StringVar HH := "0" + ToText(Hours) Else StringVar HH := Totext(Hours); // Inserting a leading zero for minutes less than 10. If Mins < 10 Then StringVar MM := "0" + ToText(Mins) Else StringVar MM := ToText(Mins); // Inserting a leading zero for seconds less than 10. If Secs < 10 Then StringVar SS := "0" + ToText(Secs) Else StringVar SS := ToText(Secs); // Output line in the time formula field. HH[1 to 2] + ":" + MM[1 to 2] + ":" + SS[1 to 2]; {timeconv.doc} :< /1rt79{}02]_a68Ksy:<gi0*0*0*0* 0* h  hK!.TECHDOCCB <%8MO888BTimes New Roman Symbol&Arial5Courier New 1Courier8 '"hEE u)Second to hour time conversion in reportsTechnical Support DocumentUUse this as a standard format for all the technical support documents to be sent out.Michael More O'FarrellAllan D. McMordie