取月初月末
>>> $a = date('Y-m-01')
=> "2017-12-01"
>>> $b = date('t',strtotime($a))
=> "31"
>>>
取上一个月
>>> strtotime('-1 months',strtotime('2017-01-02'))
=> 1480608000
>>> date('Y-m-d' ,1480608000)
=> "2016-12-02"
>>> $a = date('Y-m-01')
=> "2017-12-01"
>>> $b = date('t',strtotime($a))
=> "31"
>>>
>>> strtotime('-1 months',strtotime('2017-01-02'))
=> 1480608000
>>> date('Y-m-d' ,1480608000)
=> "2016-12-02"
本文标题:10,PHP取月初月末日期
本文链接:https://www.haomeiwen.com/subject/lfkcoxtx.html
网友评论