code: func (t Time) DateFormat(layout string) (string, error) {
  	var buf bytes.Buffer
  	inPatternMatch := false
  	for _, b := range layout {
  		if inPatternMatch {
  			if err := t.convertDateFormat(b, &buf); err != nil {
  				return "", errors.Trace(err)
  			}
  			inPatternMatch = false
  			continue
  		}
  
  		// It's not in pattern match now.
  		if b == '%' {
  			inPatternMatch = true
  		} else {
  			buf.WriteRune(b)
  		}
  	}
  	return buf.String(), nil
  }
docs: // DateFormat returns a textual representation of the time value formatted
  // according to layout.
  // See http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_date-format