将MM/DD/YYYY格式的日期转换为MySQL日期 [英] Convert date in format MM/DD/YYYY to MySQL date
本文介绍了将MM/DD/YYYY格式的日期转换为MySQL日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个PHP函数,它以MM/DD/YYYY
格式传递日期
然后,我需要对其进行转换,以便可以将其添加到date
I have a PHP function that gets passed a date in the format MM/DD/YYYY
I need to then convert this so that it can be added to a MySQL field that is of type date
我该如何用PHP做到这一点?
How would I go about doing this in PHP?
推荐答案
$newvalue = date('Y-m-d', strtotime($originalvalue));
这篇关于将MM/DD/YYYY格式的日期转换为MySQL日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文