Reading string formatted Date and Time from CSV

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

 採用された回答

Star Strider
Star Strider 2022 年 2 月 18 日

0 投票

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")
dt = datetime
12-Feb-2022 22:00:12
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.
.

その他の回答 (1 件)

KSSV
KSSV 2022 年 2 月 18 日

0 投票

REad about readtable.

カテゴリ

ヘルプ センター および File ExchangeTables についてさらに検索

製品

リリース

R2020b

質問済み:

2022 年 2 月 18 日

回答済み:

2022 年 2 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by