calculate days between two dates

8 ビュー (過去 30 日間)
Sean Cragg
Sean Cragg 2017 年 7 月 13 日
コメント済み: Sean Cragg 2017 年 7 月 13 日
Hi, I am trying to calculate the number of days between two dates where the date is included in a file name which is structured as such:
'08Apr1978 tp2 A_01 H4.wav' '18Jan1978 tp2 A_01 H5.wav'
and want the output as the number of days, such as '1', '67', etc.
I have seen functions such as days365, daysact, daysdiff. However all of these require the financial toolbox which I do not have, and I don't fancy purchasing it just for one function. Does anybody know a simple way to do this in another way?
Thanks

採用された回答

Elias Gule
Elias Gule 2017 年 7 月 13 日
date0 = '08Apr1978';
date1 = '18Jan1978';
dForm = 'ddmmmyyyy'; % Date Format String, datenum does not necessarily need this
numDaysBetween = abs(datenum(date0,dForm) - datenum(date1,dForm));
Please do look at the documentation for the "datestr" function for date format options.
  1 件のコメント
Sean Cragg
Sean Cragg 2017 年 7 月 13 日
Perfect, thank you

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTime Series Objects についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by