calculating the difference between 2 dates
Show older comments
Dear all,
I would like to calculate the difference between the dates say,
20/11/08 and 12/10/2011 in weeks and in months
cheers
Accepted Answer
More Answers (1)
there's something better now since 2014 release I believe:
w = between(startRange,endRange,'weeks')
y = between(startRange,endRange,'years')
m = between(startRange,endRange,'months')
2 Comments
Peter Perkins
on 15 Mar 2018
Indeed:
>> between(datetime('20-Nov-2008'),datetime('12-Oct-2011'),{'weeks' 'months'})
ans =
calendarDuration
34mo 3w
Rosanna
on 11 Oct 2018
Hi all I have to compute the occurrence time (days from the starting date) of a large number (eg N=1000) of events, for which I have the Year, Month, Day, Hour, Minute in numerical format (eg 2008, 05, 23, 08, 34). How can I proceed? Thanks Rosanna
Categories
Find more on Time Series Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!