【发布时间】:2019-06-17 22:34:41
【问题描述】:
在我的项目中,我需要将日期时间四舍五入,例如“08:10”到“08:00”。
更多示例
"8:20 到 8:15" "8:31 到 8:30"
在下一步中,我需要一个额外的方法来四舍五入。
示例 “8:20 到 8:30” "8:31 到 8:45"
$shiftInPre = new \DateTime($row["time_start"] /* <-e.g. 8:02*/);
echo roundtoLastQuarterHour($shiftInPre);
【问题讨论】:
-
任意舍入 PHP 日期时间的函数:stackoverflow.com/a/57399274/339440