date to date month calculation coding

6 visualizaciones (últimos 30 días)
Shanmuganathan Chelladurai
Shanmuganathan Chelladurai el 5 de Oct. de 2018
Comentada: jonas el 5 de Oct. de 2018
input:
starting date: 01/01/2018
End date: today
output:
no. of month calculation: 9
_How to insert coding in M.file matlab

Respuestas (1)

jonas
jonas el 5 de Oct. de 2018
Editada: jonas el 5 de Oct. de 2018
dt = caldiff([datetime(2018,1,1);datetime('today')])
dt =
calendarDuration
-9mo -4d
and if you want to extract the month only
calmonths(dt)
ans =
-9

Categorías

Más información sobre Calendar en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by