Convert data table to datetime
123 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Raphael Willi
le 5 Mai 2021
Commenté : Raphael Willi
le 6 Mai 2021
I have data shown in the image.
I want to convert the second row into a datetime vector, but InputFormat doesn't work.
It's a number, e.g. 201401010000 meaning jan 1st 2014 00:00.
I tried datetime( BLA,'InputFormat','yyyyMMddHHmm')
0 commentaires
Réponse acceptée
Adam Danz
le 5 Mai 2021
Modifié(e) : Adam Danz
le 6 Mai 2021
> It's a number, e.g. 201401010000 meaning jan 1st 2014 00:00.
x = 201401010000;
dt = datetime(string(x),'InputFormat','yyyyMMddHHmm')
The 'format' property specifies the output format.
x can be a column of values.
3 commentaires
Adam Danz
le 6 Mai 2021
> I want to convert the second row into a datetime vector
> I would like to e.g. convert it to a timetable
Those are two very different questions.
I've updated my answer. After converting the column to datetime use
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Data Type Conversion 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!