将SQL Server日期时间转换为mysql日期时间

Ave*_*Joe 0 php mysql sql-server datetime

可能重复:
如何将DateTime转换为VarChar

如何将SQL日期时间(例如08/14/2012 1:05:18 PM)转换为mysql方式(即Ymd H:i:s)?

Rob*_*obB 7

取决于您想要转换它的位置.

要直接转换SQL:

convert(varchar(23), getdate(), 121)
Run Code Online (Sandbox Code Playgroud)

PHP使用日期strtotime函数:

date("Y-m-d H:i:s ", strtotime("08/14/2012 1:05:18 PM"));
Run Code Online (Sandbox Code Playgroud)