The reason you are getting a date returned of 1/1/1970 is that strtotime()
is failing and returning false
which converts to 1/1/1970
the first unix epoch date.
These sort of problems all revolve around the fact that the Americans for some obsquire reason start a date with the month and then the day and then the year. Sound ok when you speak it but it makes date convertion a bit of a nightmare because computers, and the rest of the world, use a more logical y/m/d or d/m/y. So PHP assumes it is a Amerian date format if it see's a /
in the date string.
So the date convertion would work if you were to use
$var = '11/26/1949';
echo $var . PHP_EOL;
$var = date("d/m/Y", strtotime($var));
echo $var;
But luckily it will also work if you convert the seperators to -
instead of /
$var = '26/11/1949';
echo $var . PHP_EOL;
$var = str_replace('/', '-', $var);
echo 'Converted date ' . $var . PHP_EOL;
$var = date("d/m/Y", strtotime($var));
echo $var;