I can not get rid of this error message:
Call to a member function () format for a non-object
So, I continue to search googling and get a good source, for example https://stackoverflow.com/a/212960/2/ .
I tried to do something similar, but I failed. This is my code:
$temp = new DateTime(); $data_umat['tanggal_lahir'] = $data_umat['tanggal_lahir']->format('Ym-d'); $data_umat['tanggal_lahir'] = $temp;
So, I did trial and error, and I found out if I can do this:
$data_umat['tanggal_lahir'] = date("Ymd H:i:s");
The date will be successfully converted, but it always returns today's date (which I donโt want).
I want to convert the date so that 10/22/2013 2013-10-22 .
date php
Blaze tama
source share