How do I read a text file and convert the dates and time?

8 vues (au cours des 30 derniers jours)
Sonima
Sonima le 25 Juil 2018
Modifié(e) : Sonima le 15 Août 2019
Hi! I have a text file that includes the following:
2015-06-18 12:00

Réponse acceptée

jonas
jonas le 25 Juil 2018
Modifié(e) : jonas le 25 Juil 2018
Your format string is wrong, try
datenum(tt,'yyyy-mm-dd HH:MM');
better yet, use datetime

Plus de réponses (1)

Peter Perkins
Peter Perkins le 3 Août 2018
It's likely that you want to read the file using readtable, and if you are using a recent version of MATLAB, you will get datetimes automatically. If not, you can convert to datetime after importing.
You are better off using datetime than datenum.

Catégories

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

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by