How to change the date format from 2016-2-26 to 2/26/2016. I already tried to use the format, but it did not work.
How to change the date format from 2016-2-26 to 2/26/2016. I already tried to use the format, but it did not work.
<?php
$time = strtotime('2016-2-26');
$data_formatada = date('d/m/Y',$time);
echo $data_formatada;
Will print:
2/26/2016
Simplest way to do it, by working as String , transforming the date into an array with explode . I do not know if it helps you or if you wanted to work as a date. Follow below:
<?php
$data = '2016-2-26';
$array = explode('-', $data);
$data = $array[2].'/0'.$array[1].'/'.$array[0];
print($data);
Otherwise, please let me know if I can delete the answer.