strtotime() & date() weird behaviour when converting date in to same format as it was before

后端 未结 2 1349
独厮守ぢ
独厮守ぢ 2020-12-10 20:02

I have to convert date format in to mm-dd-yyyy I don\'t know what is the current date format it is dynamic so if I have dynamic date format is already in

2条回答
  •  醉话见心
    2020-12-10 20:22

    Replacing - with / for m-d-Y will help.

    echo date('m-d-Y',strtotime(str_replace('-', '/', $date)));
    

提交回复
热议问题