필터 지우기
필터 지우기

I want to convert the Julian date 273.791667 to calendar day and time

조회 수: 17 (최근 30일)
I want to convert the Julian date 273.791667 to calandar day and time
  댓글 수: 1
James Tursa
James Tursa 2017년 7월 20일
편집: James Tursa 2017년 7월 20일
As a nit, that number should be referred to as "day of year" and not "Julian date". I know there are segments of the scientific community that call it a "Julian date", but that usage is confusing at best. E.g., the definition of the term from the USNO:
You will find variations of this term in the literature depending on the underlying time scale (e.g., UT or TT) and 0 point, but even these are not "day of the year" types of measures.

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

채택된 답변

Chad Greene
Chad Greene 2017년 7월 20일
You'll have to specify a year, but for 2017 you can get a date vector like this:
datevec(datenum(2017,0, 273.791667))
or a date string like this:
datestr(datenum(2017,0, 273.791667))
  댓글 수: 8
Thishan Dharshana Karandana Gamalathge
편집: James Tursa 2017년 7월 20일
From a .mat file "X" with size(10x8), I am trying to calculate Z. But the following code gives an error. i cannot figure out the reason. Please help me with that. Thanks.
load X
for i=1:10
Y(i)=X(i,1);
UTC_start_time(i)=datevec(datenum(2010,0,Y(i,1)));
end
James Tursa
James Tursa 2017년 7월 20일
datevec returns a vector. You cannot stuff a vector into a single element.

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

추가 답변 (1개)

Steven Lord
Steven Lord 2017년 7월 20일
Use datetime. You can 'ConvertFrom' 'juliandate' (Number of days since noon UTC 24-Nov-4714 BCE (proleptic Gregorian calendar)) or 'modifiedjuliandate' (Number of days since midnight UTC 17-Nov-1858).
If you want to determine what the 273.791667th day of the year is, try something like this. Check the day of the year using the day function with the 'dayofyear' option:
x = datetime(2017, 1, 0) + days(273.791667)
day(x, 'dayofyear')
  댓글 수: 2
Walter Roberson
Walter Roberson 2017년 7월 20일
If you want to specify that this was UTC, you can use
x = datetime(2017, 1, 0, 'TimeZone', 'UTC') + days(273.791667)
and if you then want to see it in local time,
x.TimeZone = 'local'
Note that this is not the same as
x = datetime(2017, 1, 0, 'TimeZone', 'local') + days(273.791667)
In order for the timezone conversion to be done properly, you need to set to UTC first and then change the timezone; if you just set the timezone directly like in this second example then MATLAB will assume that you mean that the given date/time information is being stated relative to your timezone.
Thishan Dharshana Karandana Gamalathge
Now when I import the local time data (converted from the Julian date), it is restricted to only two decimals. How can I have it for 6 decimals?

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

카테고리

Help CenterFile Exchange에서 Calendar에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by