I want to split the date variable in php.
Here I declare PHP variable like:
$date = 20170501;
and I want the result like this:
$date = 2017-05-01
How can I achieve this?
I want to split the date variable in php.
Here I declare PHP variable like:
$date = 20170501;
and I want the result like this:
$date = 2017-05-01
How can I achieve this?
Simple and easy way:
<?php
echo date('Y-m-d', strtotime("20170501"));
?>
Example: https://eval.in/819801