Browse Source

Análise de datas. O formato pode serser dd/mm/yyyy hh:mm O resultado strlen será acima de 10

scripts-services
bruno 1 year ago
parent
commit
e9697044bc
  1. 15
      include/util/util.php

15
include/util/util.php

@ -143,14 +143,25 @@ function contains_phone_number($string) {
return(false);
}
/*
* dd/mm/yyyy
* dd/mm/yyyy HH:mm
*/
function is_date($date) {
if (strlen($date) != 10)
/* É chamada também com esse formato
* dd/mm/yyyy HH:mm
* Portanto precisa ser mantido o < 10
* 10 verifica se tem o mínimo para procurar
*/
if (strlen($date) < 10)
return(False);
else {
// Check if the date is valid
$dt = preg_split('~/~', $date);
return(checkdate($dt[1], $dt[0], $dt[2]));
return(checkdate((int)$dt[1], (int)$dt[0], (int)$dt[2]));
}
}

Loading…
Cancel
Save