paulomartinhago
10/20/2014 - 11:30 AM

Validação de data pt_BR com preg_match

Validação de data pt_BR com preg_match

<?php

function isValidDateBR($date){
    if (preg_match("/^(\d{2})\/(\d{2})\/(\d{4})$/", $date, $matches)) {
        if (checkdate($matches[2], $matches[1], $matches[3])){
            return true;
        }
    }
    
    return false;
}