2

For Example

The time is 8:05 -> it will round up into 8:15
The time is 8:27 -> it will round up into 8:30

The Time is always round up to the next quarter hour not this example below.

The time is 8:05 -> it will round up into 8:00
The time is 8:23 -> it will round up into 8:30

Is there any trick how to achieve this method? Any help is appreciated. Thanks.

P. James
  • 415
  • 4
  • 15
  • @azad Thanks for the comment but that link is not what i needed, my question is it round up to the next quarter hour. The link you given is round the time only. – P. James Mar 21 '18 at 06:15
  • @P.James can you explain (preferably with examples) what exactly you want and how the linked post doesn't help? Also show what you have tried and explain how it isn't working – Phil Mar 21 '18 at 06:17
  • 2
    See [this answer](https://stackoverflow.com/a/10789415/283366) and swap `5` to `15` and `Math.round` for `Math.ceil` (to round up) – Phil Mar 21 '18 at 06:21
  • then what is the rounded value for `:16` – Azad Mar 21 '18 at 06:22
  • @phil The linked post given it's ony get the nearest quarter minute. In my question here is the time must be round up to the next quarter hour time. example: `code` My Time is 2:05 -> the result is 2:15 || My Time is 2:07 -> the result is 2:15`code`. – P. James Mar 21 '18 at 06:26
  • @phil ok, i will try it. thanks – P. James Mar 21 '18 at 06:28
  • @azad It will round up into `:30` – P. James Mar 21 '18 at 06:31

0 Answers0