public String format(TemporalAccessor temporal)
Formats a date-time object using this formatter.
This formats the date-time to a String using the rules of the formatter.
temporal - the temporal object to format, not null
the formatted string, not null
DateTimeException - if an error occurs during formatting
API says This formats the date-time to a String using the rules of the formatter.Can I know where can I read rules of he formatter and also in what scenarios it throws DateTimeException.Any resources to read will be of great help . I want to improve my confidence of answering date formatting questions.
"Continuous effort - not strength or intelligence - is the key to unlocking our potential."
Well, actually, there's a very large section at the top of the API documentation for DateTimeFormatter which, in great detail, goes into how to build a formatter and what the rules are for each part of the formatter.