Calculating Date and Time... I've almost have it - need help in rounding up

  • Thread starter Thread starter Kenny Bullock
  • Start date Start date
K

Kenny Bullock

I'm almost there. I received help with calculating Date and Time, and I'm
thankful. Now I need assistance with rounding the time to quarter hours.
Here's what I have so far...

If I want to calculate the difference from my start date and time which is:
7/21/2003 9:00:00 PM
and my end date time is the next day at 7/22/2003 9:15:00 AM.

My formula is this below:
Round(DateDiff("n", [StartDateTime], [EndDateTime])/60,2)

My answer is 12.25 hours. And this is correct. However, we if I change my
end date time to 9:12:00 AM, I get the answer 12.2 hours. I need the answer
to round up to the nearest quarter hour. It should also reflect 12.25
hours.

I really appreciate any help.

Thanks.

Kenny Bullock
Mgr of Tech Services
NOLHGA
 
Round(DateDiff("n", [StartDateTime], [EndDateTime])/60,2)

My answer is 12.25 hours. And this is correct. However, we if I change my
end date time to 9:12:00 AM, I get the answer 12.2 hours. I need the answer
to round up to the nearest quarter hour. It should also reflect 12.25
hours.

Round it to an integer number of quarter-hours, and then divide by
four to get hours and quarters:

(Round(DateDiff("n", [StartDateTime], [EndDateTime]) / 15, 0)) / 4
 
Back
Top