How to convert this date to Y-m-d (PHP)?
date, php
Solution
Most likely because of period `.`:
$date = '10.21.2011';
echo date('Y-m-d', strtotime(str_replace('.', '/', $date)));
Result:
2011-10-21
Problem
I have this date as a string: 10.21.2011, the format is mm.dd.yyyy How can I convert this to Y-m-d? This is what I tried, but it always gives me the 1970 date. ``` $date = date('Y-m-d', strtotime($date)); ``` Thanks!