使用php从字符串到时间戳的日期转换


Date conversion from string to timestamp using php

如何使用php将此字符串"03/16/2012 03:22PM"转换为日期时间格式存储在mysql中,即"2012-03-16 15:22:00"(以秒为单位添加00作为默认值)。

echo date('Y-m-d H:i:s',strtotime("03/16/2012 03:22PM"));

DEMO

$date = date('Y-m-d H:i:s', strtotime("03/16/2012 03:22"));