original_string: public static function datetime($check, $dateFormat = 'ymd', $regex = null)
      {
          if ($check instanceof DateTimeInterface) {
              return true;
          }
          if (is_object($check)) {
              return false;
          }
          $valid = false;
          if (is_array($check)) {
              $check = static::_getDateString($check);
              $dateFormat = 'ymd';
          }
          $parts = explode(' ', $check);
          if (!empty($parts) && count($parts) > 1) {
              $date = rtrim(array_shift($parts), ',');
              $time = implode(' ', $parts);
              $valid = static::date($date, $dateFormat, $regex) && static::time($time);
          }
  
          return $valid;
      }
code: public static function datetime($check, $dateFormat = 'ymd', $regex = null)
      {
          if ($check instanceof DateTimeInterface) {
              return true;
          }
          if (is_object($check)) {
              return false;
          }
          $valid = false;
          if (is_array($check)) {
              $check = static::_getDateString($check);
              $dateFormat = 'ymd';
          }
          $parts = explode(' ', $check);
          if (!empty($parts) && count($parts) > 1) {
              $date = rtrim(array_shift($parts), ',');
              $time = implode(' ', $parts);
              $valid = static::date($date, $dateFormat, $regex) && static::time($time);
          }
  
          return $valid;
      }
code_tokens: public static function datetime ( $ check , $ dateFormat = 'ymd' , $ regex = null ) { if ( $ check instanceof DateTimeInterface ) { return true ; } if ( is_object ( $ check ) ) { return false ; } $ valid = false ; if ( is_array ( $ check ) ) { $ check = static :: _getDateString ( $ check ) ; $ dateFormat = 'ymd' ; } $ parts = explode ( ' ' , $ check ) ; if ( ! empty ( $ parts ) && count ( $ parts ) > 1 ) { $ date = rtrim ( array_shift ( $ parts ) , ',' ) ; $ time = implode ( ' ' , $ parts ) ; $ valid = static :: date ( $ date , $ dateFormat , $ regex ) && static :: time ( $ time ) ; } return $ valid ; }
docstring: Validates a datetime value
  
  All values matching the "date" core validation rule, and the "time" one will be valid
  
  @param string|\DateTimeInterface $check Value to check
  @param string|array $dateFormat Format of the date part. See Validation::date() for more information.
  @param string|null $regex Regex for the date part. If a custom regular expression is used this is the only validation that will occur.
  @return bool True if the value is valid, false otherwise
  @see \Cake\Validation\Validation::date()
  @see \Cake\Validation\Validation::time()
docstring_tokens: Validates a datetime value