%Convert date to julian day
%Simple but useful
%By Félix Comtois-Boutet
%Created 23 january 2005
%modified by dicky and bob to include hour,minutes and seconds
%     and to compute the julian day from the start of the year under
%     consideration  - jan.31, 2007
function [julian_day]=date2julian(year,month,day,hour,minute,second)

%Specify day 0 
number_of_day_before_day_one=datenum(year,01,00); %Number of day before day one on IBM-PC
absolute_number_of_day=datenum(year,month,day); %Default day one for datenum is january 1st of year 0
julian_day=absolute_number_of_day - number_of_day_before_day_one; %Number of day since day one
julian_day=julian_day+(hour/24)+(minute/60/24)+(second/60/60/24);