问题描述:

Possible Duplicate:

Converting string to MySQL timestamp format in php

Given a date in the following format, how would I convert it into a MySQL TIMESTAMP format in PHP?

Tue, 06 Dec 2011 16:47:11 +0000

I found a similar question, but am having some difficulty in converting it into what I need.

网友答案:

date('Y-m-d H:i:s',strtotime('Tue, 06 Dec 2011 16:47:11 +0000'))

that's 'canonical' form, but MySQL will also accept

date('YmdHis',strtotime('Tue, 06 Dec 2011 16:47:11 +0000'))

(more details about that format: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-literals.html )

相关阅读:
Top