如何将日期从一种格式转换为另一种格式?

如何将日期从一种格式转换为另一种格式?

问题描述:

我在Excel工作表10年12月3日中使用这种格式的日期.因此,将其插入数据库时​​不兼容.如何将日期转换为可接受的格式?

I'm having the date in this format in a Excel worksheet 03-Dec-10. So its not compatible while inserting it into the database. How to convert the date to the acceptable format?

虽然乔恩的答案是正确的,但这是另一个选择:

While Jon's answer is correct, here is another option:

$input = '03-Dec-10';
$date = date('Ymd', strtotime($input));