How to find a start date & end date of any given year & month

前端 未结 8 1458
庸人自扰
庸人自扰 2021-01-04 05:18

I have problem in php find start date & end date of month & year , when i know the year and month ?

ex:

input - > year = 2011 , month = 0         


        
8条回答
  •  一生所求
    2021-01-04 06:11

    You should look into strtotime:

    echo date("D, M j, Y", strtotime("FIRST DAY OF MAY 2012"));
    // Tue, May 1, 2012
    echo date("D, M j, Y", strtotime("last DAY june 2012")); // gotcha! using June.
    // Thu, May 31, 2012
    

提交回复
热议问题