MATLAB Answers

Count Days in Months

16 views (last 30 days)
Behzad Navidi
Behzad Navidi on 12 Nov 2019
Answered: Steven Lord on 12 Nov 2019
Hey, I want to know the number of days of each month from 1982-01-01 to 2015-12-31.
I tried some codes from Matlab Help. till now I wrote this code:
t1 = datetime(1982,01,01); %start date
t2 = datetime(2015,12,31); %end date
T = t1:t2; %creating a range
no idea how to do it. in the end, I want to have one array (1*408)
thank you all

  0 Comments

Sign in to comment.

Accepted Answer

Steven Lord
Steven Lord on 12 Nov 2019
The "Specify Step Size", "Compare Fixed-Length Duration and Calendar Duration Step Sizes", and "Dates and End of Month" sections on this documentation page will be of use to you as will the days function.

  0 Comments

Sign in to comment.

More Answers (2)

Nadir Altinbas
Nadir Altinbas on 12 Nov 2019
why do not see this help topic
www.mathworks.com/help/matlab/ref/datetime.html

  0 Comments

Sign in to comment.


Neptune16
Neptune16 on 12 Nov 2019
you can try use this..
NumDays = daysdif('3/1/99', '3/1/00', 1)

  0 Comments

Sign in to comment.

Sign in to answer this question.

Tags