calculate days between two dates

9 visualizaciones (últimos 30 días)
Sean Cragg
Sean Cragg el 13 de Jul. de 2017
Comentada: Sean Cragg el 13 de Jul. de 2017
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

Respuesta aceptada

Elias Gule
Elias Gule el 13 de Jul. de 2017
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.

Más respuestas (0)

Categorías

Más información sobre Dates and Time 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