Hello i have a Table with Dates in String Format like 2015-03-22 08:23:33.0 how can i split this column up into date and Time and convert the format ? Thanks a lot

조회 수: 1 (최근 30일)
Hello Convert and split String DateTime in two Columms and convert Their Format
I have a DateTime columm like 2015-04-23 07:39:33.0 how can i Split this colummn up in two colummns and change the Format to something more useful than a string
THANKS

답변 (3개)

Steven Lord
Steven Lord 2016년 10월 19일
If you're using release R2016b or later, you may be interested in creating a timetable from your table. There's a function to help with that conversion: see table2timetable.

Alexandra Harkai
Alexandra Harkai 2016년 10월 19일
Function datevec could just be the one you're looking for: https://uk.mathworks.com/help/matlab/ref/datevec.html#inputarg_DateString
Also, see this topic on handling and converting dates: https://uk.mathworks.com/help/finance/handling-and-converting-dates.html

Maximilian comploj
Maximilian comploj 2016년 10월 20일
hello I found a solution which is pretty practical
myDate ='1991-12-18 18:29:05'
formatIn = 'yyyy-mm-dd HH:MM:SS'
datevec(myDate,formatIn)
It returns me a 1x6 Matrix :
1991 12 18 18 29 05
only my Dates are a collumn of lets say myCell{:,2}
but i get
>
>mel{:,2}=datevec(mel{:,2},formatIn);
Expected one output from a curly brace or dot indexing expression, but there were 118286 results.
can someone Help?

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by