convert date string to mysql datetime field April 7, 2023 by Tarik First, convert the string into a timestamp: $timestamp = strtotime($string); Then do a date("Y-m-d H:i:s", $timestamp);