Answer the question
In order to leave comments, you need to log in
How to round up time to a smaller value?
Good afternoon, the task is: "Select data for the chart, with an interval of 15 minutes." The beginning of the chart should start from some specific date, for example (9:00, or 9:15, or 9:30). And how can I now, for example, 9:48 come to 9:45?
Are there any native methods in php or mysql, or can this be done using Carbon (Laravel framework)?
Answer the question
In order to leave comments, you need to log in
$now = \Carbon\Carbon::now();
$now->minute($now->minute - $now->minute % 15)->second(0)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question