Convert datetime to specific formats in PHP

Rate this post

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

dd/mm/yyyy 18/04/2016 $userdefine = date("d/m/Y", $datetime);
echo $userdefine;
mm/dd/yyyy 04/18/2016 $userdefine= date("m/d/Y", $datetime);
echo $userdefine;
Without mins/seconds 18 April 2016  $userdefine= date("d F Y", $datetime);
echo $userdefine;
With mins/seconds 18 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

Your email address will not be published. Required fields are marked *

%d bloggers like this: