mysql date formatting with php

前端 未结 6 1752
庸人自扰
庸人自扰 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:28

    Take a look at mysql function str_to_date()

    example

    select str_to_date('10/30/2010','%m/%d/%Y') -- 2010-10-30
    

提交回复
热议问题