how to get the first and last days of a given month

后端 未结 9 476
走了就别回头了
走了就别回头了 2020-12-08 09:11

I wish to rewrite a mysql query which use month() and year() functions to display all the posts from a certain month which goes to my function as a \'Y-m-d\' parameter forma

9条回答
  •  南方客
    南方客 (楼主)
    2020-12-08 09:29

    // First date of the current date
    echo date('Y-m-d', mktime(0, 0, 0, date('m'), 1, date('Y')));
    echo '
    '; // Last date of the current date echo date('Y-m-d', mktime(0, 0, 0, date('m')+1, 0, date('Y')));

提交回复
热议问题