[Gambas-user] How to verify a date like dd/mm/yyyy?

andy2 kaoticus60 at ...151...
Fri Mar 21 08:51:48 CET 2008


in Php i found the following script. My problem is to replicate the ereg 
function.

FUNCTION ControlloData($data){
  If(!ereg("^[0-9]{2}/[0-9]{2}/[0-9]{4}$", $data)){
    RETURN FALSE;
  } ELSE {
    $arrayData = explode("/", $data);
    $Giorno = $arrayData[0];
    $Mese = $arrayData[1];
    $Anno = $arrayData[2];
    If(!checkdate($Mese, $Giorno, $Anno)){
      RETURN FALSE;
    } ELSE {
      RETURN TRUE;
    }
  }
}




More information about the User mailing list