original_string: public function normalizeDateValue($date, $outFormat = 'Y-m-d H:i:s', $inFormat = null, $nullable = false)
      {
          if (empty($outFormat)) {
              $outFormat = 'Y-m-d H:i:s';
          }
  
          if ($date instanceof DateTime) {
              return $date->format($outFormat);
          }
  
          if (null === $date) {
  
              if ($nullable) {
                  return null;
              }
  
              return $this->makeEmptyStringDate($outFormat);
          }
  
          if (null === $inFormat) {
  
              try {
  
                  $date = new Carbon($date);
  
              } catch (\Exception $e) {
  
                  if ($nullable) {
                      return null;
                  }
  
                  return $this->makeEmptyStringDate($outFormat);
              }
  
          } else {
  
              $date = DateTime::createFromFormat($inFormat, $date);
          }
  
          return $date->format($outFormat);
      }
code: public function normalizeDateValue($date, $outFormat = 'Y-m-d H:i:s', $inFormat = null, $nullable = false)
      {
          if (empty($outFormat)) {
              $outFormat = 'Y-m-d H:i:s';
          }
  
          if ($date instanceof DateTime) {
              return $date->format($outFormat);
          }
  
          if (null === $date) {
  
              if ($nullable) {
                  return null;
              }
  
              return $this->makeEmptyStringDate($outFormat);
          }
  
          if (null === $inFormat) {
  
              try {
  
                  $date = new Carbon($date);
  
              } catch (\Exception $e) {
  
                  if ($nullable) {
                      return null;
                  }
  
                  return $this->makeEmptyStringDate($outFormat);
              }
  
          } else {
  
              $date = DateTime::createFromFormat($inFormat, $date);
          }
  
          return $date->format($outFormat);
      }
code_tokens: public function normalizeDateValue ( $ date , $ outFormat = 'Y-m-d H:i:s' , $ inFormat = null , $ nullable = false ) { if ( empty ( $ outFormat ) ) { $ outFormat = 'Y-m-d H:i:s' ; } if ( $ date instanceof DateTime ) { return $ date -> format ( $ outFormat ) ; } if ( null === $ date ) { if ( $ nullable ) { return null ; } return $ this -> makeEmptyStringDate ( $ outFormat ) ; } if ( null === $ inFormat ) { try { $ date = new Carbon ( $ date ) ; } catch ( \ Exception $ e ) { if ( $ nullable ) { return null ; } return $ this -> makeEmptyStringDate ( $ outFormat ) ; } } else { $ date = DateTime :: createFromFormat ( $ inFormat , $ date ) ; } return $ date -> format ( $ outFormat ) ; }
docstring: Normalizes a date value to a given output string format.
  
  Optionally takes an expected incoming format, for string values.
  
  @param string|DateTime $date
  @param string          $outFormat
  @param string|null     $inFormat
  @param bool            $nullable    whether
  @return null|string
docstring_tokens: Normalizes a date value to a given output string format .