This question already has an answer here:
I have dates in the following format:
2016-10-12
| | |
YEAR M D
and I need:
12.10.16
| | |
D M YEAR
I have managed to parse date in source format:
$date = date_parse_from_format('YYYY-mm-dd', $dateYYYYMMDD);
But I am having trouble converting it to a new format. Could you please help.
</div>
Most flexible is to use the Datetime
class:
<?php
$date = new Datetime('2016-10-12');
var_dump($date->format('d.m.y'));
The output obviously is:
string(8) "12.10.16"