Effacer les filtres
Effacer les filtres

date of a file, but not time

1 vue (au cours des 30 derniers jours)
Damian
Damian le 21 Juil 2014
Commenté : Star Strider le 21 Juil 2014
Hi,
Im getting date and time of creation of a file with : A = dir(myfile); disp(A.date)
and I end up with
07-lip-2014 03:35:30
while all I want is :
07-07-07.
So no time and month name, 'lipiec' or 'July' as 07 - how do I do that ??
Kind regards Damian

Réponse acceptée

Star Strider
Star Strider le 21 Juil 2014
Use the .datenum option:
ds = datestr(A.datenum, 'dd-mm-yy');
So if the date of ‘A’ is today (21-lip-2014), it would return 21-07-14. See the documentation for datestr for other options.

Plus de réponses (1)

Damian
Damian le 21 Juil 2014
thank you so much !
  1 commentaire
Star Strider
Star Strider le 21 Juil 2014
My pleasure!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Dates and Time dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by