- PHP

How to make date from string in PHP

Use the combination of strtotime() and date() function.

date($yourFormat, strtotime($yourDate));

Example:

<?php
    echo date('Y-m-d', strtotime('22.10.2021'));
?>

Output: 2021-10-22