You are now following this Submission
- You will see updates in your followed content feed
- You may receive emails, depending on your communication preferences
Takes a date vector and returns the day of year, known incorrectly in the Geophysical community as the Julian calender day, i.e. 12/31/2005 is returned as day 365, day 06/22/2010 is returned as 173, etc... The function is vectorized. This function needs etime.m (R2009a and later).
USAGES
julday = datevec2doy(mydate)
INPUT
mydate: Either a 6xN or Nx6 array of date vectors, as output by
functions like datevec.
OUTPUT
julday: An Nx1 array of julian days.
-----------------------------------------------------------------------
EXAMPLE
%Take the current day and add normally distributed random days to the
%date.
tadd = randn(1,12);
mydate = datevec(now)';
mydate = repmat(mydate,1,12);
mydate(2,:) = mydate(2,:) + tadd;
day = datevec2doy(mydate);
Cite As
Joshua Carmichael (2026). day of year (https://www.mathworks.com/matlabcentral/fileexchange/27989-day-of-year), MATLAB Central File Exchange. Retrieved .
General Information
- Version 1.2.0.0 (1.68 KB)
MATLAB Release Compatibility
- Compatible with any release
Platform Compatibility
- Windows
- macOS
- Linux
