cancel
Showing results for 
Search instead for 
Did you mean: 

Formula for converting to Hours,Mins and Secs

Former Member
0 Kudos

I have a field that is formatted as a time field which gives me the time in seconds only. I just need to know how to convert the seconds into hh:mm:ss format,how do I write a formula for converting the time kindly help me.

Thanks in advance

Ramakrishna Reddy

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

//Convert Total Seconds to DD:HH:MM:SS

NumberVar TotalSec := {your seconds formula of field};

NumberVar Days := Truncate (TotalSec / 86400);

NumberVar Hours := Truncate (Remainder ( TotalSec,86400) / 3600);

NumberVar Minutes := Truncate (Remainder ( TotalSec,3600) / 60);

NumberVar Seconds := Remainder ( TotalSec , 60);

//comment or delete the following to format it

//with the text instead of looking like 12:05:21:05

ToText ( Days, '00', 0,'') + ':'+

ToText( Hours, '00', 0,'') + ':'+

ToText ( Minutes,'00', 0,'') + ':'+

ToText( Seconds,'00', 0,'')

Ian

Former Member
0 Kudos

Dear Ian can you please write the formula for me.

Thanks in advance

Ramakrishna Reddy

Former Member
0 Kudos

That is the formula?

Unless you refer to the seconds formula

Just use datediff()

@seconds

DateDiff ("s", startDateTime, endDateTime)

replace start and end datetimes with your fields.

Ian

Former Member
0 Kudos

thanks ian it helped me to solve my question

Answers (0)