필터 지우기
필터 지우기

Convert time format from Julian calendar (days since 1950-01-01 00:00:00 UTC) to normal/gregorian calendar (YYYY-MM-DD hh:mm:ss)

조회 수: 37 (최근 30일)
Hi,
I am struggling converting a my date vector from Julian days (units: days since 1950-01-01 00:00:00 UTC) to a normal date format. Possibly, my final vector wuold be in the form YYYY-MM-DD hh:mm:ss.
Thabk you very much.
  댓글 수: 1
Carlotta
Carlotta 2023년 3월 9일
I USED THIS CODE AND IT WORKED
tref = datetime(1950,01,01);
TT = tref + days(time); % character vector
tt = datenum(TT); %numeric vector

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

답변 (2개)

Sarvesh Kale
Sarvesh Kale 2023년 3월 9일
Hi Carlotta,
You might find the link to the post useful https://in.mathworks.com/matlabcentral/answers/1303-convert-julian-date-to-calendar-days, I hope this helps
Thanks

Steven Lord
Steven Lord 2023년 3월 9일
That definition of "julian date" doesn't match either of the ones supported by the datetime function with the "t = datetime(X,'ConvertFrom',dateType)" syntax.
Ah, looking at the Wikipedia page for Julian day you're working with CNES JD data? You could use the formula given on that page, but I'd probably use the approach you gave in your comment.
Though I am curious why you're converting it to a serial date number. As stated on the datenum documentation page use of datenum is not recommended. If you describe what you're hoping to do with those serial date numbers we may be able to suggest how to accomplish those tasks with datetime and duration functionality.

카테고리

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