- preg_match: documentation ( source)
- date: documentation ( source)
- strtotime: documentation ( source)
<?php
echo date('Y-m-d', strtotime('2017-01-01'));
echo "\n";
$mydate = date('Y-m-d', strtotime('2017-01-01'));
echo date('m/d/Y', strtotime('01/01/2017'));
echo "\n";
echo preg_match('/^\d{4}-\d{2}-\d{2}$/', $mydate);