Try this:
$old_date = Date_create("2010-04-19 18:31:27");
$new_date = Date_format($old_date, "d/m/Y");
There is also the DateTime
object if you want to go that way: http://www.php.net/manual/en/datetime.construct.php
If your date is in the format of a string use the explode function
array explode ( string $delimiter , string $string [, int $limit ] )
//In the case of your code
$length = strrpos($oldDate," ");
$newDate = explode( "-" , substr($oldDate,$length));
$output = $newDate[2]."/".$newDate[1]."/".$newDate[0];
Hope the above works now
$source = 'your varible name';
$date = new DateTime($source);
$_REQUEST["date"] = $date->format('d-m-Y');
echo $_REQUEST["date"];
<?php
$test1='2010-04-19 18:31:27';
echo date('d/m/Y',strtotime($test1));
?>
try this
Source: Stackoverflow.com