I can not get rid of this error message:
Call to a member function format() on a non-object
So, I go on googling and get some good source like this StackOverflow question.
I tried to do something similar, but I failed. This is my code :
$temp = new DateTime();
/*ERROR HERE*/ $data_umat['tanggal_lahir'] = $data_umat['tanggal_lahir']->format('Y-m-d');
$data_umat['tanggal_lahir'] = $temp;
So, i did trial & errors, and I found out if I do this:
$data_umat['tanggal_lahir'] = date("Y-m-d H:i:s");
The date will successfully converted, BUT it always return today's date (which i dont want).
I want to convert the date so that 10/22/2013
will be 2013-10-22
.