フィルターのクリア

Calculating duration between dates in a CSV file and the present date

11 ビュー (過去 30 日間)
Vinay
Vinay 2023 年 6 月 14 日
回答済み: Samay Sagar 2023 年 6 月 14 日
I am reading data from csv file which has a column that has date in the format like 5 Jun 2021. I want to calculate the duration between each date and present date. How can I do this?

採用された回答

Samay Sagar
Samay Sagar 2023 年 6 月 14 日
You can use the between function to calculate duration between 2 dates. You can iterate over each value in column and apply the following operation :
currentDate = datetime('now');
givenDate = datetime('5-Jun-2021');
duration = between(givenDate,currentDate)
duration = calendarDuration
2y 9d 16h 24m 6.8842s

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by