src/Util/Time.php
static public function validate($time)
    {
      // Check if date is a string
      if(is_string($time) && strlen(trim($time)) > 0)
        return false;
        
      // Check if date matches pattern
      if(!preg_match('/^' . self::PATTERN . '$/', $time, $matches))
        return false;
          
      // Extract values from time
      if(count($matches) == 5)
        list($original, $hours, $minutes, $seconds, $microtime) = $matches;
      else
        list($original, $hours, $minutes, $seconds) = $matches;
              
      // If microtime is set at it to seconds
      if(isset($microtime))
        $seconds += $microtime;
                
      // Check if all values are valid
      if(!self::validateTime($hours, $minutes, $seconds))
        return false;
                  
      return true;
    }
static public function validate($time)
    {
      // Check if date is a string
      if(is_string($time) && strlen(trim($time)) > 0)
        return false;
        
      // Check if date matches pattern
      if(!preg_match('/^' . self::PATTERN . '$/', $time, $matches))
        return false;
          
      // Extract values from time
      if(count($matches) == 5)
        list($original, $hours, $minutes, $seconds, $microtime) = $matches;
      else
        list($original, $hours, $minutes, $seconds) = $matches;
              
      // If microtime is set at it to seconds
      if(isset($microtime))
        $seconds += $microtime;
                
      // Check if all values are valid
      if(!self::validateTime($hours, $minutes, $seconds))
        return false;
                  
      return true;
    }
static public function validate ( $ time ) { // Check if date is a string if ( is_string ( $ time ) && strlen ( trim ( $ time ) ) > 0 ) return false ; // Check if date matches pattern if ( ! preg_match ( '/^' . self :: PATTERN . '$/' , $ time , $ matches ) ) return false ; // Extract values from time if ( count ( $ matches ) == 5 ) list ( $ original , $ hours , $ minutes , $ seconds , $ microtime ) = $ matches ; else list ( $ original , $ hours , $ minutes , $ seconds ) = $ matches ; // If microtime is set at it to seconds if ( isset ( $ microtime ) ) $ seconds += $ microtime ; // Check if all values are valid if ( ! self :: validateTime ( $ hours , $ minutes , $ seconds ) ) return false ; return true ; }
Validate if a string is a time

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