Calculating Hours, Mins over 24 hour periods  
Author Message
Atxa





PostPosted: Sun Apr 30 14:22:58 CDT 2006 Top

SQL Server Developer >> Calculating Hours, Mins over 24 hour periods

Below I'm returning the decimal duration [decDuration], a HH:MM:SS format
without "padding" 0's [realDuration], and a HH:MM:SS format with "padding"
0's [realDuration2].

If you run my EXAMPLE, in RESULTS below you'll see that [decDuration] and
[realDuration] work fine, but [realDuration2] looses 24 hours if a duration
spans over a day.

Can someone help me modify my formula for [realDuration2] so it doesn't
loose 24 hours if a duration is longer than a day?

EXAMPLE **********










realDuration2


RESULTS **********

[decDuration] [realDuration] [realDuration2]
------------------------------------------------------------
29.145000 29:8:42 05:08:42

SQL Server252  
 
 
Aaron





PostPosted: Sun Apr 30 14:22:58 CDT 2006 Top

SQL Server Developer >> Calculating Hours, Mins over 24 hour periods




select

AS decDuration,




AS realDuration,




AS realDuration2







> Below I'm returning the decimal duration [decDuration], a HH:MM:SS format
> without "padding" 0's [realDuration], and a HH:MM:SS format with "padding"
> 0's [realDuration2].
>
> If you run my EXAMPLE, in RESULTS below you'll see that [decDuration] and
> [realDuration] work fine, but [realDuration2] looses 24 hours if a
> duration spans over a day.
>
> Can someone help me modify my formula for [realDuration2] so it doesn't
> loose 24 hours if a duration is longer than a day?
>
> EXAMPLE **********
>




>




> realDuration2
>
>
> RESULTS **********
>
> [decDuration] [realDuration] [realDuration2]
> ------------------------------------------------------------
> 29.145000 29:8:42 05:08:42
>
>


 
 
scott





PostPosted: Sun Apr 30 15:00:29 CDT 2006 Top

SQL Server Developer >> Calculating Hours, Mins over 24 hour periods that did it, thanks.







>
> select

> AS decDuration,
>



> AS realDuration,
>



> AS realDuration2
>
>
>
>
>


>> Below I'm returning the decimal duration [decDuration], a HH:MM:SS format
>> without "padding" 0's [realDuration], and a HH:MM:SS format with
>> "padding" 0's [realDuration2].
>>
>> If you run my EXAMPLE, in RESULTS below you'll see that [decDuration] and
>> [realDuration] work fine, but [realDuration2] looses 24 hours if a
>> duration spans over a day.
>>
>> Can someone help me modify my formula for [realDuration2] so it doesn't
>> loose 24 hours if a duration is longer than a day?
>>
>> EXAMPLE **********
>>




>>




>> AS realDuration2
>>
>>
>> RESULTS **********
>>
>> [decDuration] [realDuration] [realDuration2]
>> ------------------------------------------------------------
>> 29.145000 29:8:42 05:08:42
>>
>>
>
>


 
 
--CELKO--





PostPosted: Sun Apr 30 17:33:28 CDT 2006 Top

SQL Server Developer >> Calculating Hours, Mins over 24 hour periods Why not keep track of total minutes (or seconds, if appropriate) and
let the front end worry about the display format? Tiered architecture
and all that jazz?