7 Replies Latest reply on Dec 10, 2010 3:45 PM by RoC1909

    Question regarding ROUNDING a number to nearest Quarter

    RoC1909 Level 1

      Hello all,


      Please forgive me if I am not posting this in the appropriate area, but I am not sure which area it could go into (scripting, Javascript, Designer...) and the Acrobat Scripting forum seemed like as good a place as any.


      I have field that allows a user to enter a 2 digit number with 2 decimal places. (i.e 12.30 or 9.78 up to 24.00. This field corresponds to the hours in a day). What I would like is to "round" to the nearest quarter hour. As a example, if a person enters:


      22.15 - the field would round UP to 22.25

      9.78 - the field would round DOWN to 9.75

      12.10 - the field would round DOWN to 12.00

      .15 - would round UP to .25

      .96 - would round to 1.00

      .01 to .24 - would round UP to .25


      In essence, any number they place into this field (up to 24.00) would round appropriately.


      I looked at the FormCalc ROUND function and DATE / TIME functions, but it doesn't look like any of those would allow me to do what I need to do. I imagine it would have to be in JavaScript but again, I am not sure.


      If anyone can point me in the proper direction, it would be greatly appreciated and hopefully, I explained what I want to do correctly.