且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将日期字符串转换为mysql datetime字段

更新时间:2023-01-29 14:48:46

首先,将字符串转换为时间戳:

First, convert the string into a timestamp:

$timestamp = strtotime($string);

然后做

date("Y-m-d H:i:s", $timestamp);