×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Eray Demirel
Added: Nov 18, 2016 1:47 PM
Views: 10
Examines a datetime string against given format and returns if it is a valid datetime string
  1. function is_valid_date($date,$format="Y-m-d"){
  2.     $d = DateTime::createFromFormat($format, $date);
  3.     return $d && @$d->format($format) == $date;
  4. }