PHP date(): minutes without leading zeros

后端 未结 15 1525
粉色の甜心
粉色の甜心 2020-12-13 23:17

I\'d like to know if there is a formatting letter for PHP\'s date() that allows me to print minutes without leading zeros, or whether I have to manuall

15条回答
  •  青春惊慌失措
    2020-12-14 00:06

    i just did this one line solution

    $min = intval(date('i',strtotime($date)));

    Using ltrim method may remove all the leading zeroes.For ex if '00' min.In this case this will remove all the zeroes and gives you empty result.

提交回复
热议问题