- str_replace: documentation ( source)
<?php
$date = '2001-09-08';
$date = str_replace('-','/',$date);
$formats_arr = array('m-d-Y','m/d/Y','Y-m-d','Y/m/d');
//$dateobj = new datetime($date);
$dateobj = datetime::create($date);
foreach ($formats_arr AS $format)
echo $format . " ==> " . $datetime::format($format) . "\n";