本文介绍了四舍五入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在表格中有一个开始和结束时间,我通过使用

diff:(DateDiff(" n",[Start],[End]))找到总时间/>

我想把这个数字四舍五入到最接近的15分钟(计费期)。

我试过

rounddif:CInt([diff] / 15)* 15

但它向上或向下舍入到最近的15.我我想强迫它总是围捕。

例如。 6分钟将轮到15,33分钟将轮到45等等


任何帮助将不胜感激。


我正在使用MS Access 2007

I have a Start and End time in a table which I find the total time by using
diff: (DateDiff("n",[Start],[End]))

I then want to round this figure up to the nearest 15mins (billing period).
I tried
rounddif: CInt([diff]/15)*15
but it rounds up or down to the nearest 15. I want to force it to always round up.
eg. 6min would round to 15, 33mins would round to 45, etc

Any help would be greatly appreciated.

I am using MS Access 2007

推荐答案



tmdan。


试试这个

rounddif:Round([diff] / 15)* 15

Hi, tmdan.

Try this
rounddif: Round([diff]/15)*15





这个小函数将在15分钟时执行正确的''Round Up。间隔''最长为2小时的差异:

This little Function will perform the proper ''Round Up at 15 min. Intervals'' for a differential of up to 2 hours:

展开 | 选择 | Wrap | 行号


这篇关于四舍五入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 04:51