Get month of a given date

前端 未结 6 1477
醉话见心
醉话见心 2020-12-14 19:08

Get month of a given date which is stored in a PHP time variable in \'Y-m-d\' format

6条回答
  •  一整个雨季
    2020-12-14 19:41

    Try date_parse_from_format():

    $date = "2010-08-12";
    $d = date_parse_from_format("Y-m-d", $date);
    echo $d["month"];
    

提交回复
热议问题