Converting seconds to hh:mm:ss format

Hi

I am converting seconds to hh:mm:ss from seconds (CR2016)

I usually use the formula below which works fine for anything under 24 hours

CStr(CTime(currentfieldvalue/ 86400), "hh:mm:ss")

I have a few fields that go above 24 hours, so for 25:00:06 - this reads 01:00:06.

I have tried

 CStr(CTime(currentfieldvalue/ 3600), "hh:mm:ss") - doesnt work

Any ideas on how this can be used for anything over 24 hours

Thanks
Mark WilsonBI DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
Something like

CStr(Trunc( currentfieldvalue / 86400)) & "d " &  CStr(CTime((currentfieldvalue mod 86400) / 86400), "hh:mm:ss") 

Open in new window


should do it. Cause any time formatting is formatting time, not durations.
0
Rgonzo1971Commented:
HI,

pls try
CStr(Trunc( currentfieldvalue / 3600)) & ":" & CStr(CTime(currentfieldvalue / 86400), "mm:ss") 

Open in new window

Regards
0
Mark WilsonBI DeveloperAuthor Commented:
Hi
Thanks for the answers but not quite correct

Answer 1

CStr(Trunc( currentfieldvalue / 86400)) & "d " &  CStr(CTime((currentfieldvalue mod 86400) / 86400), "hh:mm:ss")  this gives it in days, hh,mm,ss - I would like the hours in hh:mm:ss - so 25:00:06 - not 01:01:00:06

Answer 2

CStr(Trunc( currentfieldvalue / 3600)) & ":" & CStr(CTime(currentfieldvalue / 86400), "mm:ss")

This is nearly there but gives additional numbers i.e. 25:00:00:06
0
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

Rgonzo1971Commented:
then try
CStr(Trunc( currentfieldvalue / 3600)) &  Right(CStr(CTime(currentfieldvalue / 86400), "mm:ss") , 6)

Open in new window

0
Mark WilsonBI DeveloperAuthor Commented:
Thanks for the answer

This is now coming out as 25.0000:06
0
Rgonzo1971Commented:
then try
CStr(Trunc( currentfieldvalue / 3600), 0) &  Right(CStr(CTime(currentfieldvalue / 86400), "hh:mm:ss") , 6)

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mark WilsonBI DeveloperAuthor Commented:
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.