MATLAB Answers


9 views (last 30 days)
Emili Sorsa
Emili Sorsa on 29 Apr 2021
Commented: Emili Sorsa on 29 Apr 2021
Hi everyone,
i have a question:
i have a .txt file with two collums, which are the date and the time in this format: YYYYMMDD HHMMSS
now i want to convert it to this format DD-MM-YYYY HH:MM:SS
I already managed to convert the date but not the time:
date = datetime(File.txt,'ConvertFrom','yyyymmmdd')
03-Feb-2021 00:00:00
thanks for your help!!

Answers (1)

VBBV on 29 Apr 2021
%if true
datetime(File.txt,'ConvertFrom','*.txt','InputFormat','yyyy-MM-dd HH:mm:ss')
  1 Comment
Emili Sorsa
Emili Sorsa on 29 Apr 2021
well it does not quiet work ...
As my text file looks like this:
20210126 120051
and nearly 130 000 rows

Sign in to comment.


Community Treasure Hunt

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

Start Hunting!

Translated by