date to date month calculation coding

input:
starting date: 01/01/2018
End date: today
output:
no. of month calculation: 9
_How to insert coding in M.file matlab

1 件のコメント

jonas
jonas 2018 年 10 月 5 日
have you even read the answer?

サインインしてコメントする。

回答 (1 件)

jonas
jonas 2018 年 10 月 5 日
編集済み: jonas 2018 年 10 月 5 日

0 投票

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

カテゴリ

タグ

コメント済み:

2018 年 10 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by