Calculating duration between dates in a CSV file and the present date
8 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
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)
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!