I have a String
with a date in this format: 2021-10-05
. Need to convert this String
to ZonedDateTime
type. Tried to do it in this way, but the Text could not be parsed. Time can be 00:00:00. Any suggestions?
public static final ZoneId ZONE_ID = ZoneId.of("UTC");
ZonedDateTime dt2 = ZonedDateTime.parse(date, //date String = 2021-10-05
DateTimeFormatter.ofPattern("yyyy-MM-dd").withZone(ZONE_ID));