PHP Carbon take number of minutes & convert to days

后端 未结 2 665
情歌与酒
情歌与酒 2021-01-22 18:27

I am trying to convert a number on minutes into number of days using Carbon.

$minutes = 1400;

I want to do something like below (which of cours

2条回答
  •  伪装坚强ぢ
    2021-01-22 18:29

    Not tested, but a quick look at the docs suggests it might be aimed more at DateTime objects than differences in time, so you could do something like this:

    $now  = Carbon::now();
    $days = $now->diffInDays($now->copy()->addMinutes($minutes));
    

提交回复
热议问题