function y=mydate(x);
% MYDATE(X)  returns the date and time corresponding to decimal day
%            X is in decimal days from 1 january 1990 to 31 dec 2000
%       the format of the returned string is   "dy mon year, day:hr:mn:sc.dec"

year=1990:2000;
day=365*ones(size(year));

ix=find(~rem(year,4));
day(ix)=day(ix)+1;
day=[0 cumsum(day)];
x=x-day;

ix=find(x>=0);
day=min(x(ix))+1;
year=year(length(ix));

hr=(day-floor(day))*24;
day=floor(day);

mn=(hr-floor(hr))*60;
hr=floor(hr);

sc=(mn-floor(mn))*60;
mn=floor(mn);

dec=(sc-floor(sc))*1000;
sc=floor(sc);
dec=floor(dec);

mon=[0 31 28 31 30 31 30 31 31 30 31 30 31];
if ~rem(year,4), mon(3)=mon(3)+1; end
mon=cumsum(mon);
dy=day-mon;
ix=find(dy>0);
mon=min(length(ix));
dy=min(dy(ix));

y=[myint2str(dy,2) ' ' num2mon(mon) ' ' int2str(year) ', ' ...
    myint2str(day,3) ':' myint2str(hr,2) ':' myint2str(mn,2) ...
    ':' myint2str(sc,2) '.' myint2str(dec,3)];
