functions to convert decimal to minutes or expressions will do..

  • Thread starter Thread starter 121782
  • Start date Start date
1

121782

I am working on this program using access.. And i am about to compute thier
total sum in my report... i had a hard time of computing time of flight, so
what I did is, I separated the hours from minutes, and computed them as
numbers.. now i want to compute their total sum... (sum of time) i have a
formula of =[SEG]+[MSEG]/60*.60 but i am getting wrong results because the
decimal value doesn't carry to my hour.. because it rounds of every 100, and
not by 6.. how will i get the sum, or how will i convert that decimal value
to a minute value.. please help me.. i really need it too badly.. tnx...
 
Hi,
if I understand right you convert minutes in decimal value (e.g. 30 minutes
=0.5) and then you sum them and you wanna revert back the decimal result in
hours and minutes. Is that correct?
If this is the situation do this: (let's call the result of your sum
sum_of_min)

Int(sum_of_min) gives you the hours
sum_of_min - Int(sum_of_min) gives you the decimal part that is the minutes
to be converted in sessagesimal notation and to do that multiplies * 0.6 i.e.
(sum_of_min - Int(sum_of_min))*0.6 and those are the minutes resulting from
your sum.

HTH Paolo
 
Paolo said:
Hi,
if I understand right you convert minutes in decimal value (e.g. 30 minutes
=0.5) and then you sum them and you wanna revert back the decimal result in
hours and minutes. Is that correct?
If this is the situation do this: (let's call the result of your sum
sum_of_min)

Int(sum_of_min) gives you the hours
sum_of_min - Int(sum_of_min) gives you the decimal part that is the minutes
to be converted in sessagesimal notation and to do that multiplies * 0.6 i.e.
(sum_of_min - Int(sum_of_min))*0.6 and those are the minutes resulting from
your sum.

HTH Paolo

121782 said:
I am working on this program using access.. And i am about to compute thier
total sum in my report... i had a hard time of computing time of flight, so
what I did is, I separated the hours from minutes, and computed them as
numbers.. now i want to compute their total sum... (sum of time) i have a
formula of =[SEG]+[MSEG]/60*.60 but i am getting wrong results because the
decimal value doesn't carry to my hour.. because it rounds of every 100, and
not by 6.. how will i get the sum, or how will i convert that decimal value
to a minute value.. please help me.. i really need it too badly.. tnx...
 
Sorry but I reply just on this discussion group. So if you have further
question post them here.

Cheers Paolo

121782 said:
Paolo said:
Hi,
if I understand right you convert minutes in decimal value (e.g. 30 minutes
=0.5) and then you sum them and you wanna revert back the decimal result in
hours and minutes. Is that correct?
If this is the situation do this: (let's call the result of your sum
sum_of_min)

Int(sum_of_min) gives you the hours
sum_of_min - Int(sum_of_min) gives you the decimal part that is the minutes
to be converted in sessagesimal notation and to do that multiplies * 0.6 i.e.
(sum_of_min - Int(sum_of_min))*0.6 and those are the minutes resulting from
your sum.

HTH Paolo

121782 said:
I am working on this program using access.. And i am about to compute thier
total sum in my report... i had a hard time of computing time of flight, so
what I did is, I separated the hours from minutes, and computed them as
numbers.. now i want to compute their total sum... (sum of time) i have a
formula of =[SEG]+[MSEG]/60*.60 but i am getting wrong results because the
decimal value doesn't carry to my hour.. because it rounds of every 100, and
not by 6.. how will i get the sum, or how will i convert that decimal value
to a minute value.. please help me.. i really need it too badly.. tnx...
 
See:
Calculating elapsed time
at:
http://allenbrowne.com/casu-13.html

The article explains how to use DateDiff() to calculate the difference in
minutes.

After you sum the minutes, you can then convert the total to hours and
minutes, as shown.
 
ok.. so try to imagine that i am working on flight time billing of a
pilot... so everyday, they have flights ryt.. in my form, i announced those
time as numbers.. so i have a seperate box for hour and seperate box for
minute... in my report, i am getting their total sum.... so my hour is [SEG]
and my minutes is [MSEG] so in my report because i need to set them as
running sum, for example: the result will be 3.45 [ which is 3 hours and 45
minutes] but if another flight will be added for example: 3.45+1.20, the
result in my report will be 4.65 minutes which is not acceptable, because
that .65 should be .05, and i need the result of 5.05..
 
In your report put two invisible fields, one with the running sum of mseg and
one with the running sum of seg*100/60. In the first field you'll have the
total of hours(let's call it inv_hrs) and in the second the sum of minutes in
decimal(dec_min).
In the visible total field for the hours put inv hrs+int(dec_min) (do you
add to the hours the hours originated by the sum of minutes) and in the
visible field for the minutes (dec_min - Int(dec_min))*0.6
I didn't test this solution but I think it should works.

HTH Paolo

121782 said:
pilot... so everyday, they have flights ryt.. in my form, i announced those
time as numbers.. so i have a seperate box for hour and seperate box for
minute... in my report, i am getting their total sum.... so my hour is [SEG]
and my minutes is [MSEG] so in my report because i need to set them as
running sum, for example: the result will be 3.45 [ which is 3 hours and 45
minutes] but if another flight will be added for example: 3.45+1.20, the
result in my report will be 4.65 minutes which is not acceptable, because
that .65 should be .05, and i need the result of 5.05..

Paolo said:
Sorry but I reply just on this discussion group. So if you have further
question post them here.

Cheers Paolo
 

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

Back
Top