function day=eventtoday(event);
% Fix firstday vector so it becomes a column vector, not a row
% vector.  rcg Dec. 11, 2002
ev=event;
index=isnan(ev);
ev(index)=1000000*ones(size(ev(index)));
mo=floor(ev/1.0e6);
da=floor(ev/1.0e4-mo*100);
hr=floor(ev/100-mo*1.0e4-da*100);
mm=ev-mo*1e6-da*1e4-hr*100;
firstday=[0;31;60;91;121;152;182;213;244;274;305;335]; %leapyear
day=firstday(mo)+da+(hr/24)+(mm/24/60);
day(index)=event(index);
return
