如何将MM / DD / YYYY转换为YYYY-MM-DD? [英] How to convert MM/DD/YYYY to YYYY-MM-DD?

查看:147
本文介绍了如何将MM / DD / YYYY转换为YYYY-MM-DD?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个jquery日历,将输入值设置为MM / DD / YYYY

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?

编辑

Gordon是对的 - 他的链接指向我这个答案

Gordon was right - his link pointed me to this answer

$mysql_date = date('Y-m-d H:i:s', strtotime($user_date));


推荐答案

$date = "07/12/2010";
$your_date = date("Y-m-d", strtotime($date));

我希望我的答案有用:)

I hope my answer is useful :)

这篇关于如何将MM / DD / YYYY转换为YYYY-MM-DD?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆