how to convert string to date?

9 vues (au cours des 30 derniers jours)
Pasquale
Pasquale le 22 Mar 2019
Modifié(e) : Stephan le 22 Mar 2019
I would convert this string '10:12:25 Tue 11-Dec-18' into a date with this format: 11/12/2018 10:12 AM.
I tried to use the function datetime, but it does not recognize the string as a date, because of the day name Tue.

Réponse acceptée

Stephan
Stephan le 22 Mar 2019
Modifié(e) : Stephan le 22 Mar 2019
Date = '10:12:25 Tue 11-Dec-18'
res = datetime(Date ,'InputFormat','HH:mm:ss eee dd-MMM-yy','Format','dd/MM/yyyy HH:mm a')
Date =
'10:12:25 Tue 11-Dec-18'
res =
datetime
11/12/2018 10:12 AM

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB 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