Days between dates

“2021-01-01” is, as the error says, a String. It’s not a ZonedDateTime. You can’t just type in a String and have it magically become something else. You have to convert that String into a ZonedDateTime. And then you can get at the seconds and do the math with that.

There are lots of options. See ZonedDateTime (Java SE 11 & JDK 11 ) for the full ZonedDateTime docs.