Convert to date format dd/mm/yyyy Convert to date format dd/mm/yyyy php php

Convert to date format dd/mm/yyyy


You can use a regular expression or some manual string fiddling, but I think I prefer:

date("d/m/Y", strtotime($str));


<?php$test1='2010-04-19 18:31:27';echo date('d/m/Y',strtotime($test1));?>

try this


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