Timestamps of start and end of month

后端 未结 7 1841
独厮守ぢ
独厮守ぢ 2020-12-03 17:04

How can one get the timestamps of the first and last minutes of any month using PHP?

7条回答
  •  隐瞒了意图╮
    2020-12-03 17:40

    I think better then

    $first_minute = mktime(0, 0, 0, date("n"), 1);
    $last_minute = mktime(23, 59, 0, date("n"), date("t"));
    

    is:

    $first_minute = mktime(0, 0, 0, date("n"), 1);
    $last_minute = mktime(23, 59, 0, date("n") + 1, 0);
    

提交回复
热议问题