Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Javier Lopez
Added: Oct 12, 2018 10:14 PM
Views: 8
Tags: no tags
Validar si un string es una fecha
  1. public static function validateDate($date, $format = 'Y-m-d'){
  2.    $d = DateTime::createFromFormat($format, $date);
  3.    return $d && $d->format($format) === $date;
  4. }