I'm formatting date in php. But it's returning current year.
This is my code:
<?php
$date = "2 January, 2018";
echo date('d-m-Y', strtotime( $date ));
?>
I need date format in d-m-Y format.
I'm formatting date in php. But it's returning current year.
This is my code:
<?php
$date = "2 January, 2018";
echo date('d-m-Y', strtotime( $date ));
?>
I need date format in d-m-Y format.
Remove Comma
<?php
$date = "2 January 2018";
echo date('d-m-Y', strtotime( $date ));
?>
Remove the comma from the date string.