If you're looking for a way to normalize a date into MySQL format, use the following
(如果您正在寻找一种将日期标准化为MySQL格式的方法,请使用以下命令)
$phpdate = strtotime( $mysqldate );
$mysqldate = date( 'Y-m-d H:i:s', $phpdate );
The line $phpdate = strtotime( $mysqldate )
accepts a string and performs a series of heuristics to turn that string into a unix timestamp.
($phpdate = strtotime( $mysqldate )
接受一个字符串并执行一系列试探法,以将该字符串转换为unix时间戳。)
The line $mysqldate = date( 'Ymd H:i:s', $phpdate )
uses that timestamp and PHP's date
function to turn that timestamp back into MySQL's standard date format.
($mysqldate = date( 'Ymd H:i:s', $phpdate )
使用该时间戳和PHP的date
函数将该时间戳转换回MySQL的标准日期格式。)
( Editor Note : This answer is here because of an original question with confusing wording, and the general Google usefulness this answer provided even if it didnt' directly answer the question that now exists)
(( 编者注 :之所以在这里给出此答案,是因为最初的问题带有令人困惑的措辞,而且即使该答案没有直接回答现在存在的问题,该答案也具有一般的Google实用性))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…