src/Util/Date.php
static public function validate($date)
    {
      // Check if date is a string
      if(is_string($date) && strlen(trim($date)) > 0)
        return false;
        
      // Check if date matches pattern
      if(!preg_match('/^' . self::PATTERN . '$/', $date, $matches))
        return false;
          
      // Extract values from date
      list($original, $year, $month, $day) = $matches;
          
      // Check if all values are valid
      if(!self::validateDate($year, $month, $day))
        return false;
            
      return true;
    }
static public function validate($date)
    {
      // Check if date is a string
      if(is_string($date) && strlen(trim($date)) > 0)
        return false;
        
      // Check if date matches pattern
      if(!preg_match('/^' . self::PATTERN . '$/', $date, $matches))
        return false;
          
      // Extract values from date
      list($original, $year, $month, $day) = $matches;
          
      // Check if all values are valid
      if(!self::validateDate($year, $month, $day))
        return false;
            
      return true;
    }
static public function validate ( $ date ) { // Check if date is a string if ( is_string ( $ date ) && strlen ( trim ( $ date ) ) > 0 ) return false ; // Check if date matches pattern if ( ! preg_match ( '/^' . self :: PATTERN . '$/' , $ date , $ matches ) ) return false ; // Extract values from date list ( $ original , $ year , $ month , $ day ) = $ matches ; // Check if all values are valid if ( ! self :: validateDate ( $ year , $ month , $ day ) ) return false ; return true ; }
Validate if a string is a date

@param string $date
@return boolean true if string is a date, false otherwise
Validate if a string is a date