cancel
Showing results for 
Search instead for 
Did you mean: 

Convert days to hh:mm:ss

0 Kudos
644

Hi all,

I have come across many threads which help to convert minutes or seconds to days, hours etc, but cannot find anything that works to convert days to hours, minutes and seconds.

Can someone please point me to an existing thread or link?

I have an existing field in my table which calculates number of days between two dates, now I would like to split this by hours, minutes and seconds.

Thanks for any help.

Accepted Solutions (1)

Accepted Solutions (1)

ayman_salem
Active Contributor

If you work with BusinessObjects, you can do the following:

Define the following variables:

-- Calculate the time difference between dates in seconds.

SecTotal: =TimeBetween([D1];[D2];SecondPeriod)

If you already have the time difference in "days," convert it in seconds. (ndays*24*60*60)

-- HH: =Truncate(([SecTotal]/3600);0)

-- MM: =Truncate((([SecTotal]/3600)-[HH])*60;0)

-- SS: =[SecTotal]-Truncate(([SecTotal]/60);0)*60

hope that will help you

0 Kudos

Thanks Ayman!

Massive help.

Answers (1)

Answers (1)

p244500
Active Contributor
0 Kudos

Hi,

I guess you expect to get date different and time different . There is no way to convert days to time. please correct your heading. If you need to get days and time difference plz use bellow FM

CALL FUNCTION 'SD_CALC_DURATION_FROM_DATETIME'