What’s wrong with
public String toString() {
return super.toString()
+ String.format(" %1$F-%2$F", startDate, endDate);
}
I get
Caused by: java.util.UnknownFormatConversionException: Conversion = ‘F’
at java.util.Formatter$FormatSpecifier.conversion(Formatter.java:2606)
at java.util.Formatter$FormatSpecifier.(Formatter.java:2634)
at java.util.Formatter.parse(Formatter.java:2480)
at java.util.Formatter.format(Formatter.java:2414)
at java.util.Formatter.format(Formatter.java:2367)
at java.lang.String.format(String.java:2769)
I wanted to print the ISO 8601 date defined in java.util.Formatter
I think the date formatting patterns require a prefix:
The example for the
Fmodifier also shows this syntax:So the following pattern should work: