%% timju2ut.m converts from J2000 (Julian) secs
%% to UT, day, month and year. The equations used
%% are from the Satellite Times articles by 
%% Dr T.S.Kelso.
%%

function [timmat,dno,year]=timju2ut(j2000)

% j2000 = J2000 time (secs)
% timmat = UT time (hours)
% day = day  
% month = month
% year = year

dc=0.5+j2000/86400;                %number of days different from 0UT 1st Jan 2000
dno=zeros(size(dc));
year=dno;
for i=1:prod(size(dc))             %Calculate the day number and year of point of interest
 [dno(i),year(i)]=daynum3(1,2000,floor(dc(i)));
end
jd=2451545.0+j2000/86400;          %required Julian date
timf=rem(jd+0.5,1);                %UT of measurement (fraction of day)
timmat=24*timf;                    %UT of measurement (hours)
