Reading string formatted Date and Time from CSV
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Yuri Katz
am 18 Feb. 2022
Beantwortet: Star Strider
am 18 Feb. 2022
Hi
I have csv files with the following format of date and time:
"Saturday, 12 February 2022 22:00:12"
Obviously this just one of the columns in the file, with additional data in adjacent columns. How can this be read into usable date and time data?
Thanks
0 Kommentare
Akzeptierte Antwort
Star Strider
am 18 Feb. 2022
‘Obviously this just one of the columns in the file, with additional data in adjacent columns. How can this be read into usable date and time data?’
str = "Saturday, 12 February 2022 22:00:12";
dt = datetime(str, 'InputFormat',"eeee, d MMMM yyyy HH:mm:ss")
See the datetime documentation section on infmt ('InputFormat') for more examples and an extended discussion. See the Format section to understand how to set the display format for the array datetime produces.
Replace ‘str’ here with the column reference to your table.
.
0 Kommentare
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Dates and Time finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!