Author |
Message
|
LH33 |
Posted: Tue Feb 07, 2006 12:52 pm Post subject: Conversion to hours and seconds??? |
|
|
Master
Joined: 21 Nov 2002 Posts: 200
|
I want to calculate a Duration and format it as follows: HHH:MMSS
The input is an interval (number of widgets) and an estimated time integer in seconds. I want to multiply the number of widgets by the estimated time to get the total seconds (number 1 below). Then I want to divide the total seconds by 3600 to get the hours and remainder (number 2 below). How can I extract the remainder (the decimal portion) so I can then multiply it by 60 to get the remaining seconds (number 3 below)?
Example:
1. Number of widgets = 14 X 720 (estimated time) = 10080 seconds
2. 10080 seconds / 3600 = 2.8 (2.8 hours)
3. .8 * 60 = 48 minutes
Final Format = 002:4800 (2 hours and 48 minutes)
Thanks for any help you can provide! |
|
Back to top |
|
 |
wschutz |
Posted: Tue Feb 07, 2006 1:07 pm Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Well. if its broker V6, you can use the FORMAT option on the CAST function to generate your final format. (and the EXTRACT function to pull out the hours and minutes for the calculation) _________________ -wayne |
|
Back to top |
|
 |
LH33 |
Posted: Tue Feb 07, 2006 1:11 pm Post subject: |
|
|
Master
Joined: 21 Nov 2002 Posts: 200
|
I am on Version 5.04 - will your suggestion work on this version? If not, any other suggestions?
Thanks! |
|
Back to top |
|
 |
JT |
Posted: Tue Feb 07, 2006 1:35 pm Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
If I understand you correctly, I think you're looking for the MOD function. |
|
Back to top |
|
 |
LH33 |
Posted: Tue Feb 07, 2006 2:27 pm Post subject: |
|
|
Master
Joined: 21 Nov 2002 Posts: 200
|
Yes, thank you! the MOD function worked. |
|
Back to top |
|
 |
wschutz |
Posted: Tue Feb 07, 2006 4:06 pm Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Next time, I'd read the question a little closer ...  _________________ -wayne |
|
Back to top |
|
 |
JT |
Posted: Tue Feb 07, 2006 4:41 pm Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
.......but please don't stop providing solutions that use new V6 features/functions. |
|
Back to top |
|
 |
wschutz |
Posted: Tue Feb 07, 2006 4:44 pm Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
 _________________ -wayne |
|
Back to top |
|
 |
|