I have a getter in Java 8 that I set to the below, problem is the output is Sat Jan 11 00:00:00 AEDT 2020
The class has to remain as a Date
, StartDate
is a LocalDate
.
public static Date getStartDate() {
return Date.from(StartDate.atStartOfDay()
.atZone(ZoneId.systemDefault())
.toInstant());
}
I need it to return the value as YYYY-MM-DD
and I am struggling to work it out.
Yes, this is an assignment. No idea on the logic where we've been told to set one to Date
and the other as LocalDate
, other than to annoy me......
Any help appreciated.