将mm/dd/yyyy转换为mysql时间戳吗? [英] Convert mm/dd/yyyy into mysql timestamp?

查看:91
本文介绍了将mm/dd/yyyy转换为mysql时间戳吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试了大约两个小时才能使它正常运行.我正在尝试将输入的日期(如11/18/2012)转换为mysql时间戳,但我尝试过的所有操作最终都变成了0000-00-00 00:00:00或数据库中的NULL :( I' m使用PHP + MYSQL,所以这两种解决方案都很棒

I've been trying for about two hours to get this working with no luck. I'm trying to convert a date that's entered like 11/18/2012 into a mysql timestamp but everything I've tried just ends up as either 0000-00-00 00:00:00 or NULL in the database :( I'm using PHP + MYSQL so a solution in either would be great

推荐答案

尝试一下

 $release_date=$_POST['release_date'];
    echo date("Y-m-d H:i:s",strtotime($release_date));

这篇关于将mm/dd/yyyy转换为mysql时间戳吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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