I have this as my date if I use $patient['DATE_UNIT_ADM']
just as.
28/07/2012 00:00:00
but when I do this to get it to a Y/m/d format it goes back to
1970/01/01
$timestamp = strtotime($patient['DATE_UNIT_ADM']);
$AdmissionDate = date('Y/m/d', $patient['DATE_UNIT_ADM']);
Why is this. Whats happening in strtotime
?
UPDATE.
there is still something funny here.
$timestamp = strtotime($patient['DATE_UNIT_ADM']);
still give no value, but doing
echo $patient['DATE_UNIT_ADM']
gives me the correct date.
any idea
var_dump
returns boolean false
and var_dump($patient['DATE_UNIT_ADM'])
returns string '28/07/2012 00:00:00' (length=19)
SOLUTION
strtotime(str_replace("/", ".", $patient['DATE_UNIT_ADM']));
You forgot the timestamp / are using the wrong variable (the original date time), if the code you posted is correct: