tags:

views:

42

answers:

3

I have a float value that is derived from dates being subtracted. How do I convert this float value into minutes? Perferably if I could convert it into hours and minutes otherwise just minutes....

For example here are some values I have:

4.12676944443956

3.91463738425955

0.102466473770619

0.0308067515434232

0.0564043209888041

The answer to Pauls question is that these are days.

+1  A: 

Assuming that these values indicate days and the precision you want to achieve is minutes. The best possible way for you to do this would be to write a function to multiply this value with 1440 (number of minutes in a day) and round off the places past the decimal. I may be missing something though since the answer cannot be this simple.

Deep Kapadia
A: 

If that's days and fractions thereof,

Hours = :date_value * 24;
Minutes = :date_value * 24 * 60

Integer Hours     = trunc(:date_value * 24)
Remaining Minutes = mod(:date_value * 24, 60) 

Integer Days        = trunc(:date_value)
Remaining Int Hours = mod(:date_value, 24)
Remaining Minutes   = mod(:date_value, 24 * 60);

In Oracle, the "remainder" function is MOD(number, divisor).

Adam Musch
A: 

When I do a query in SQL server to subtract two dates and cast as a float it gives me the result in days. So to convert your float to the number of minutes multiply by 1440.

gbogumil