How to calculate difference between two dates when my date is in dd-mm format only
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Poulomi Ganguli
am 1 Jul. 2019
Bearbeitet: Alex Mcaulley
am 1 Jul. 2019
Hello:
I have dates of a partcular year as follows in the matrix format:
month1 date1 month2 date2
6 9 10 1
7 15 8 15
11 15 12 4
I want to calculate the number of days in between date2/month2 - date1/month1. How to calculate it?
0 Kommentare
Akzeptierte Antwort
Alex Mcaulley
am 1 Jul. 2019
Bearbeitet: Alex Mcaulley
am 1 Jul. 2019
Using datetime:
A = [6 9 10 1
7 15 8 15
11 15 12 4];
t = datetime(zeros(size(A,1),2),A(:,[1,3]),A(:,[2,4]))
res = duration(t(:,2)-t(:,1),'Format','d')
res =
3×1 duration array
114 days
31 days
19 days
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Dates and Time finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!