필터 지우기
필터 지우기

date time to datenum

조회 수: 1 (최근 30일)
Poulomi Ganguli
Poulomi Ganguli 2017년 8월 15일
편집: Stephen23 2017년 8월 15일
I have an array of time series in the format dd-mm-yyyy hh:mm:ss, I want to convert it to datenum:
'29-May-1930 00:00:00'
'29-May-1930 01:00:00'
'29-May-1930 02:00:00'
'29-May-1930 03:00:00'
'29-May-1930 04:00:00'
'29-May-1930 05:00:00'
'29-May-1930 06:00:00'
'29-May-1930 07:00:00'
'29-May-1930 08:00:00'
'29-May-1930 09:00:00'
'29-May-1930 10:00:00'
How to do so?

채택된 답변

Adam
Adam 2017년 8월 15일
What is wrong with the obvious
res = datenum( yourData );
?
  댓글 수: 2
Poulomi Ganguli
Poulomi Ganguli 2017년 8월 15일
Earlier, I put 'Inputformat','yyyy-mm-dd' and was getting error messages.
Stephen23
Stephen23 2017년 8월 15일
편집: Stephen23 2017년 8월 15일
@Poulomi Ganguli: Did you notice that yyyy-mm-dd is arranged in a totally different order to your dates? And is missing the hour, minute, and second units? Instead of guessing what format string to use and getting it wrong, you could simply read the documentation:
and then try:
dd-mmm-yyyy HH:MM:SS
For example:
>> datenum('29-May-1930 00:00:00','dd-mmm-yyyy HH:MM:SS')
ans = 705067

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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