src/KsUtils/Dt.php
public static function convert($str, $formatIn, $formatOut)
    {
        if (!$str) {
            return null;
        }

        $date = \DateTime::createFromFormat($formatIn, $str);

        if (!$date) {
            return null;
        }

        return $date->format($formatOut);
    }
public static function convert($str, $formatIn, $formatOut)
    {
        if (!$str) {
            return null;
        }

        $date = \DateTime::createFromFormat($formatIn, $str);

        if (!$date) {
            return null;
        }

        return $date->format($formatOut);
    }
Converts date string from one format to another, f.e.
31.12.2013 <-> 2013-12-31
@param  sting       $str       Input date string
@param  string      $formatIn  Format of input date string
@param  string      $formatOut Format of output date string
@return string|null Output date string or null if error