mysql date formatting with php

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

    Nick rulez's answer also applies to inserts and updates:

    INSERT INTO my_table (id, date) values (1, str_to_date('10/30/2010','%m/%d/%Y'))
    

提交回复
热议问题