AnsweredAssumed Answered

How do I round a time stamp minute?

Question asked by darrynpeterlowe on May 15, 2016
Latest reply on May 18, 2016 by darrynpeterlowe

I've got most of the essentials for a project I'm building but I'm having an issue with rounding timestamps.


I have a button that when pressed enters into the field the current timestamp. But it inevitably ends up with something like:


16/05/2016 10:02:07


The tricky thing is that I want the minute to be either a 0 or a 5 but I'm not sure how I would do that.


Typical rounding would be to round it to 10:00 but it gets a little tricky for other fields so I'll describe this in detail a little bit more now.


So I have the following fields:


Start Travel



End Travel


Now if Start Travel was 10:02 then I'd want it to be rounded to 10:00 but if it took me 1 minute to get to site which in this case would make Onsite 10:03 then I don't want it to round down to 10:00 otherwise the time would be 0 minutes so I would want it to round UP to make the time 10:05.


Obviously there would need to be some checking of the previous field in order to round up (or maybe not you'd just round the time up regardless I guess) but in any case I don;t know how I'd do it. Does it need to be converted to numbers then the result displayed as timestamp or what?


Thanks for your help.