Convert datetime to specific formats in PHP

There are many way to use date time with specific combination with format  in PHP..

dd/mm/yyyy18/04/2016$userdefine = date("d/m/Y", $datetime);
echo $userdefine;
mm/dd/yyyy04/18/2016$userdefine= date("m/d/Y", $datetime);
echo $userdefine;
Without mins/seconds18 April 2016 $userdefine= date("d F Y", $datetime);
echo $userdefine;
With mins/seconds18 April 2016 10:12:59 $userdefine= date("d F Y H:i:s", $datetime);
echo $userdefine;

 

There are same other formats like $userdefine= date(“m-d-Y”, $datetime);

echo $userdefine; —output like this 04-18-2016

$userdefine = date(“d-m-Y”, $datetime);

echo $userdefine; ——out put like this 18-04-2016

 

 

 

Leave a Reply