Converting time help.

F

Floyd Forbes

Is there an easy way in access to convert minuites to fraction of the time.
I would like to use 0.25, 0.50 and 0.75. How do I go about geting this to
work?
 
P

pietlinden

Is there an easy way in access to convert minuites to fraction of the time.
I would like to use 0.25, 0.50 and 0.75. How do I go about geting this to
work?

divide minutes by 60?
 
L

Lord Kelvan

something like


Format([yourdatetimefield],"nn")/60

as a field in a query sould do it

what it does it only takes the minutes section of the date time field
and divides it by 60 (minutes in an hour)

the nn means minutes in the format function

hope this helps

Regards
Kelvan
 
L

Lord Kelvan

in what regards you want things rounded to every 15 mins?

or do you not care about a value that is 14 minutes?

if you want it rounded tell me how you want it rounded.

Regards
Kelvan
 
F

Floyd Forbes

I would like it round minutes by .25, 0.50 and 0.75.
My company payroll system round the minutes.

Thanks for the help.
 
L

Lord Kelvan

yea sorry let me explain do you want
1 -15 mins to be .25
16 - 30 mins to be .5
31 - 45 mins to be .75
and
0,46-59 mins to be .0

or something inbetween

Regard
Kelvan
 
L

Lord Kelvan

place this as a field in your query

minutegroup: IIf(Format([yourdatetimefield],"nn") Between 1 And 15,".
25",IIf(Format([yourdatetimefield],"nn") Between 16 And 30,".
50",IIf(Format([yourdatetimefield],"nn") Between 31 And 45,".75",".
00")))

though i think that produces incorrect results basically it is saying
if you spend 46 mins on whatever you are spending no minutes on it

it would be more prudent to do this

minutegroup: IIf(Format([yourdatetimefield],"nn") Between 1 And 15,".
25",IIf(Format([yourdatetimefield],"nn") Between 16 And 30,".
50",IIf(Format([yourdatetimefield],"nn") Between 31 And 45,".
75",IIf(Format([yourdatetimefield],"nn") Between 46 And 59,"1.0",".
00"))))

alternativally if you dont want a whole number and only a fraction it
would be even better to round down not up

minutegroup: IIf(Format([yourdatetimefield],"nn") Between 0 And 14,".
00",IIf(Format([yourdatetimefield],"nn") Between 15 And 29,".
25",IIf(Format([yourdatetimefield],"nn") Between 30 And 44,".50",".
75")))

so in that case 46 minutes woudl place you in the .75 group while 5
mins would place you in the .00 time group which is more correct data
than the first option that placed 46 mins in the .00 time group and 5
mins in the .15 group

i would choose the second option but the third option if it had to be
a fraction because the first option provides incorrect data

hope this helps

Regards
Kelvan
 
Top