Julian day to date

조회 수: 11 (최근 30일)
Daphne PARLIARI
Daphne PARLIARI 2020년 8월 29일
댓글: Med Aymane Ahajjam 2023년 1월 31일
Hello everyone.
I have a simple (hopefuly) question. In the attached excel file, column C contains year and column D the day of year (e.g. 01/01/2007 is day 1 and 31/12/2007 is day 365).
Is there a way to convert this date type into the format dd-mm-year, with each of the three numbers in separate columns (one for the day, one for the month and one for the year)?
Thank you in advance!

답변 (1개)

the cyclist
the cyclist 2020년 8월 29일
편집: the cyclist 2020년 8월 29일
Here is one way:
dateTable = readtable('KALAMARIA_2007.xlsx','Range','C:D');
julianDate = datetime(dateTable.YEAR,1,dateTable.JULIANDAY);
julianY = year(julianDate);
julianM = month(julianDate);
julianD = day(julianDate);
Of course, you don't really need to calculate the Julian year again, since it is already available as an input, but I made it for consistency.
  댓글 수: 1
Med Aymane Ahajjam
Med Aymane Ahajjam 2023년 1월 31일
THANK YOU!

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

카테고리

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