I still fail test case 5 of days between dates? Could any of you guys tell me what I miss? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I still fail test case 5 of days between dates? Could any of you guys tell me what I miss?

You need to calculate exactly how many days have passed between two dates. Task: Calculate how many days have passed between two input dates, and output the result. Input Format: Two strings that represent the dates, first date should be the older date. Date format: Month DD, YYYY Output Format: A number representing the number of days between the two dates. Sample Input: August 15, 1979 June 15, 2018 Sample Output: 14184 https://code.sololearn.com/chLUWA8YarJ6/?ref=app

9th Jan 2023, 1:20 PM
Killiam Chances
Killiam Chances - avatar
2 Answers
+ 2
I think you are not considering the leap years, but I am not sure if this is really the problem, because your code looks rather confusing. I recommend to read about parsing dates and calculating time differences using the Java standard API. https://www.baeldung.com/java-string-to-date https://www.baeldung.com/java-date-difference
9th Jan 2023, 5:44 PM
Tibor Santa
Tibor Santa - avatar
+ 2
April misspelled.. Recheck.
9th Jan 2023, 5:47 PM
Jayakrishna 🇮🇳