original_string: public function toDatabase($value, Driver $driver)
      {
          if ($value === null || is_string($value)) {
              return $value;
          }
          if (is_int($value)) {
              $class = $this->_className;
              $value = new $class('@' . $value);
          }
  
          $format = (array)$this->_format;
  
          if ($this->dbTimezone !== null
              && $this->dbTimezone->getName() !== $value->getTimezone()->getName()
          ) {
              if (!$value instanceof DateTimeImmutable) {
                  $value = clone $value;
              }
              $value = $value->setTimezone($this->dbTimezone);
          }
  
          return $value->format(array_shift($format));
      }
code: public function toDatabase($value, Driver $driver)
      {
          if ($value === null || is_string($value)) {
              return $value;
          }
          if (is_int($value)) {
              $class = $this->_className;
              $value = new $class('@' . $value);
          }
  
          $format = (array)$this->_format;
  
          if ($this->dbTimezone !== null
              && $this->dbTimezone->getName() !== $value->getTimezone()->getName()
          ) {
              if (!$value instanceof DateTimeImmutable) {
                  $value = clone $value;
              }
              $value = $value->setTimezone($this->dbTimezone);
          }
  
          return $value->format(array_shift($format));
      }
code_tokens: public function toDatabase ( $ value , Driver $ driver ) { if ( $ value === null || is_string ( $ value ) ) { return $ value ; } if ( is_int ( $ value ) ) { $ class = $ this -> _className ; $ value = new $ class ( '@' . $ value ) ; } $ format = ( array ) $ this -> _format ; if ( $ this -> dbTimezone !== null && $ this -> dbTimezone -> getName ( ) !== $ value -> getTimezone ( ) -> getName ( ) ) { if ( ! $ value instanceof DateTimeImmutable ) { $ value = clone $ value ; } $ value = $ value -> setTimezone ( $ this -> dbTimezone ) ; } return $ value -> format ( array_shift ( $ format ) ) ; }
docstring: Convert DateTime instance into strings.
  
  @param string|int|\DateTime|\DateTimeImmutable $value The value to convert.
  @param \Cake\Database\Driver $driver The driver instance to convert with.
  @return string|null
docstring_tokens: Convert DateTime instance into strings .