I had the string beneath out of $datum = $_COOKIE['ingevoerde_datum'];
:
[[52,2,"2020-01-10 15:00:00",0]]
I stripped it to:
2020/01/10
I did that by doing this:
$datum_zonder_eind = substr_replace($datum, '', -14) . "<br />\n";
$datum_zonder_begin = substr($datum_zonder_eind, strpos($datum_zonder_eind, "_") + 8);
$streepje = str_replace('-', '/', $datum_zonder_begin);
echo $streepje;
Now I want to convert it to a date, found this online:
$input = $streepje;
$date = strtotime($input);
echo date('D/M/Y H:i:s', $date);
But this gives me:
Thu/Jan/1970 01:00:00
What am I doing wrong?
` you'd appended to the date string wasn't doing it any favours either... – CD001 Jan 10 '20 at 11:14