This question already has an answer here:
- Convert one date format into another in PHP 15 answers
I have to convert this string date 2016-09-26 00:00:00.000
to the yyyy-mm-dd
format without other characters.
Can you help me, please?
</div>
This question already has an answer here:
I have to convert this string date 2016-09-26 00:00:00.000
to the yyyy-mm-dd
format without other characters.
Can you help me, please?
</div>
You can just use the DateTime class along with the format()
method:
$d = new DateTime('2016-09-26 00:00:00.000');
echo $d->format('Y-m-d');