Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default convert a number of seconds to HH:MM:SS?

I use timer in my code.
It calculates the time elapsed by subtracting a number of seconds fro
another number of seconds e.g. 50256.3470 - 40155.1

The value returned, should be in the format HH:MM:SS.

How is this done in code?

I dont want to write any functions into ranges on the sheet or forma
any cells...

Thanks!!

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 136
Default convert a number of seconds to HH:MM:SS?

Divide the formula by 86400 and format the cell as hh:mm:ss.
86400=24 hrs*60min*60seconds. Excel stores time as the decimal fraction
of one day. i.e. 12:00:00=0.5, 18:00:00=0.75, etc.

Steff_DK < wrote:
I use timer in my code.
It calculates the time elapsed by subtracting a number of seconds from
another number of seconds e.g. 50256.3470 - 40155.1

The value returned, should be in the format HH:MM:SS.

How is this done in code?

I dont want to write any functions into ranges on the sheet or format
any cells...

Thanks!!!


---
Message posted from http://www.ExcelForum.com/

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 136
Default convert a number of seconds to HH:MM:SS?

OK, no format:
range("A1").value=format(yourFormula/86400,"hh:mm:ss")

JWolf wrote:

Divide the formula by 86400 and format the cell as hh:mm:ss.
86400=24 hrs*60min*60seconds. Excel stores time as the decimal fraction
of one day. i.e. 12:00:00=0.5, 18:00:00=0.75, etc.

Steff_DK < wrote:

I use timer in my code. It calculates the time elapsed by subtracting
a number of seconds from
another number of seconds e.g. 50256.3470 - 40155.1
The value returned, should be in the format HH:MM:SS.

How is this done in code?

I dont want to write any functions into ranges on the sheet or format
any cells...

Thanks!!!


---
Message posted from http://www.ExcelForum.com/

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to convert number in to time lenght, minutes and seconds? Bojan Excel Discussion (Misc queries) 3 November 3rd 08 07:35 AM
Convert time in number of seconds Heera Excel Worksheet Functions 2 August 22nd 08 01:29 PM
Convert "Time Interval" in "hours : minutes : seconds" to seconds Ianukotnorth New Users to Excel 7 May 8th 05 08:11 PM
How do i convert a number of seconds to a date/time? Margo Excel Worksheet Functions 2 January 5th 05 12:09 AM
Convert seconds to minutes and seconds in excel anonymous Excel Worksheet Functions 3 December 25th 04 08:38 PM


All times are GMT +1. The time now is 04:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"