I have a datetime column in MySQL.
How can I convert it to the display as mm/dd/yy H:M (AM/PM) using PHP?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you’re looking for a way to normalize a date into MySQL format, use the following
The line
$phpdate = strtotime( $mysqldate )accepts a string and performs a series of heuristics to turn that string into a unix timestamp.The line
$mysqldate = date( 'Y-m-d H:i:s', $phpdate )uses that timestamp and PHP’sdatefunction to turn that timestamp back into MySQL’s standard date format.(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)