How to remove seconds (ss) in decimals time

G

Guest

Hi. I have this decimal value: 0,104239055 wich means 02:30:06.

Once I have to sum severel decimal times, the sum of the seconds are
transformed into minutos. but that in my case is not important.

Image if I sum ten times 0,104239055 I final result would be 25:01:03 but I
want that the result would be 25:00:00 (1,041666667*10)

I thin that if I remove seconds I have my correct time.

Regards in advance,
Marco
 
S

Stefan Hoffmann

hi Marco,
Image if I sum ten times 0,104239055 I final result would be 25:01:03 but I
want that the result would be 25:00:00 (1,041666667*10)
I thin that if I remove seconds I have my correct time.
So you like to get the result in hours only?

1/24 is the value for one hour, 1/1440 for one minute:

resultRoundedToHours = CInt(yourSum * 24) / 24
resultRoundedToMinutes = CInt(yourSum * 1440) / 1440


mfG
--> stefan <--
 
G

Guest

it's mainly in hours or half an hours. Probably quarters can also happen.


Regards,
Marco
 
S

Stefan Hoffmann

hi Marco,
it's mainly in hours or half an hours. Probably quarters can also happen.

resultRoundedToQuarters = CInt(yourSum * 1440 / 15) * 15/1440


mfG
--> stefan <--
 
J

John Spencer

(10*0,104239055) * 24 * 60 * 60 will be the total number of seconds (call
that N)

N \ 3600 = number of hours

N \ 60 Mod 60 = Number of minutes

Seconds are always 00 so

N\3600 & ":" & Format( N \ 60 Mod 60, "00") & ":00"

One problem is that this will NOT round up so if the duration of time
returned was 25:01:56, you would still see 25:01:00
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
G

Guest

Hi,

I think with this solution I can get what I need:

resultRoundedToMinutes = CInt(yourSum * 1440) / 1440

I have to make some more tests.

Thank you both.

Many thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top