Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone,
I have a metric which provides me a duration in the following format : HH:SS
I would like to obtain a numeric value indicating the exact number of hours for this duration.
for example if the duration is 03:30 (3h30min) I want to obtain 3.5 as a number.
Is there any function that could help me with that ?
Thanks you very much
Alexandre BERNARD
Multiply by 24 rather than divde:
Interval#('3:30', 'H:mm') * 24 = 3.5
If the duration is a timestamp, you can divide by 24.
try this and use your timefield instead of "03:30"
=num(left('03:30',2) & ',' & Right('03:30',2)/6)
The problem is that I want to convert a duration into a number. The format is different so I cant Divide it.
Are there any functions that convert Time duration into numbers ?
Multiply by 24 rather than divde:
Interval#('3:30', 'H:mm') * 24 = 3.5
If the time duration is calculated using QV time values and functions, it is actually a number, representing days. Shorter intervals will be fractions of a day; 1 hour has a value of 1/24. So if you multiply the interval by 24 you will get a value in decimal hours.
If the interval is a string value, then you can convert that to a QV numeric interval using Interval# (as I did above).
Hi Alexandre,
Please try:
Convert time stamp into hour decimal value :
hour( interval(([timestamp]/86400), 'hh:mm:ss') )
+ (((Minute (interval(([timestamp]/86400), 'hh:mm:ss')) * 100) / 60)
+ (Second (interval(([timestamp]/86400), 'hh:mm:ss')) * 100) / 3600 ) / 100
or
If the field is TimeSecond then you can convert using below:
(TimeSecond /3600) which converts Seconds to duration in decimal
Regards
Neetha