Stephen - 2013-09-14 16:52:07
Hello
I am trying to format the date and time from an email header inorder to store in a MYSQL database as Datetime variable
The following seems logical, but doesn't work
// Read Header
$datestr = $overview->date;
// Format data string
$dateTime = DateTime::createFromFormat('D, d M Y H:i:s O', $datestr);
$errors = DateTime::getLastErrors();
if (!empty($errors['warnings'])) {
echo "Invalid Date\n"; }
// variable to store
$date = $dateTime->format('Y-m-d H:m:s');
Error
Fatal error: Call to a member function format() on a non-object in
Any advise would be appreciated
Thank you