WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Time - Timer and Date Functions
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Convert time in seconds to DdHhMmSs

Keywords:   Convert time in seconds to DdHhMmSs 

Question:

Quick question does someone have the code to do this. I am retrieving the time on how long it takes to do several tasks. I am getting the total time in seconds. Does any have the code to convert the time in seconds to Day(s)/Hour(s)/Minute(s)/Second(s) to make reports with

Example:

356556 = 4-Days 3-Hours 2-Minutes 36-Seconds

Answer:

time = 356556

days = time / 86400
hours = (time / 3600) - (days * 24)
minutes = (time / 60) - (days * 1440) - (hours * 60)
seconds = time mod 60

Article ID:   W15717
File Created: 2003:05:13:11:29:48
Last Updated: 2003:05:13:11:29:48