How to convert MM/DD/YYYY to YYYY-MM-DD?

前端 未结 10 1806
忘了有多久
忘了有多久 2020-12-14 18:03

I have a jquery calendar that sets the input value to MM/DD/YYYY

How would I convert it so that my database column (date) can accept it correctly?

EDIT

10条回答
  •  我在风中等你
    2020-12-14 18:59

    Alternatively you can do this without using the explode:

    $date = "12/25/2010";
    $mysql_date = date('Y-m-d', strtotime($date));
    

    You can now use $mysql_date to insert into your database.

提交回复
热议问题