mysql date formatting with php

前端 未结 6 1757
庸人自扰
庸人自扰 2021-01-29 02:56

I have a date (\"mm/dd/yyyy\") and I want to convert it to a MySQL DATE data type (like yyyy-mm-dd)

How do I do it with PHP?

6条回答
  •  北荒
    北荒 (楼主)
    2021-01-29 03:33

    If your date is in $your_date, then:

    $mysql_date = date('Y-m-d', strtotime($your_date));
    

    See strtotime() documentation.

提交回复
热议问题