How to remove extra text from date and timestamp ?

8 ビュー (過去 30 日間)
Maryam Mohiti Ardakani
Maryam Mohiti Ardakani 2021 年 11 月 8 日
Hi everyone
I have a text file which I I am imprting as an table in Matlab.
I have a timestamp like"2019-01-01T00:00:00Z" and want to remove the "T" and "Z" in it so I only have date and time and can use datenum for calculations.
Can you help me with this?
Thank you in advance

採用された回答

Seth Furman
Seth Furman 2021 年 11 月 8 日
We strongly recommend using datetime instead of datenum. As Star Strider mentioned, datetime allows you to specify the 'T' and 'Z' characters in the input format. If you're using readtable, you may want to consider using readtimetable, which helps avoid the extra step of converting timestamp data into datetime.
  1 件のコメント
Maryam Mohiti Ardakani
Maryam Mohiti Ardakani 2021 年 11 月 9 日
Thank you. This solved my problem.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by