/** * Formats this date-time using the specified formatter. * <p> * This date-time will be passed to the formatter to produce a string. * * @param DateTimeFormatter $formatter the formatter to use, not null * @return string the formatted date-time string, not null * @throws DateTimeException if an error occurs during printing */ public function format(DateTimeFormatter $formatter) { return $formatter->format($this); }