example: if i have this string or number 020117 first two numbers are the day, first four numbers are day and month, full text are day, month and year.
How can I make this happen 020117 -> 02/01/2017.
Please, I need your help
example: if i have this string or number 020117 first two numbers are the day, first four numbers are day and month, full text are day, month and year.
How can I make this happen 020117 -> 02/01/2017.
Please, I need your help
<?php
$s = "020117";
print substr($s, 0, 2)."/".substr($s, 2, 2)."/20".substr($s, 4, 2);
?>
or as function:
<?php
function itd($i){
return substr($i, 0, 2)."/".substr($i, 2, 2)."/20".substr($i, 4, 2);
}
print itd('020117');
?>