Problem 720. Find number of days
The input is two date in string format (dd-mm-yyyy), Find out the number of days between these two dates.
Example:
input: '15-jan-2000' '24-may-2012'
(if today is 24-may-2012)
output: 4509
Solution Stats
Problem Comments
-
7 Comments
Show
4 older comments
Richard Zapor
on 25 May 2012
Answers are wrong. They ignore leap days. There are four from 15-Jan-2000 thru May 2012. function datenum provides correct answer
Bart Vandewoestyne
on 25 May 2012
I agree with Richard. I also think that the first two out of the three test cases are wrong.
Aurelien Queffurust
on 25 May 2012
I also agree with the above comments
@bmtran (Bryant Tran)
on 25 May 2012
as do i
Ned Gulley
on 25 May 2012
I went ahead and updated the test.
vaibhav hosur
on 20 Aug 2015
daysact(x1,x2) not working
Szász Botond
on 19 Apr 2021
Is there a mistake in the problem or the site?
https://www.timeanddate.com/date/durationresult.html?y1=1000&m1=1&d1=15&y2=2012&m2=5&d2=24
Solution Comments
Show commentsProblem Recent Solvers199
Suggested Problems
-
Remove any row in which a NaN appears
8575 Solvers
-
Project Euler: Problem 7, Nth prime
1414 Solvers
-
839 Solvers
-
Make a run-length companion vector
638 Solvers
-
617 Solvers
More from this Author11
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!