I have date variable i need to convert to a another type of date formats
//the date and time
$date="16-03-2014 00:16:01";
the format i want convert is like below
Sunday 16th of March 00:16:01
can someone please help me to do this.
Use DateTime::createFromFormat to create a Datetime object, then output with specified format.
$date="16-03-2014 00:16:01";
$date = DateTime::createFromFormat('d-m-Y H:i:s', $date);
echo $date->format('l jS \of F H:i:s');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With