How do I convert date into day of the year?

9 views (last 30 days)
Hello!
Excel file format as follows:
  • A column: Year
  • B column: Month
  • C column: Day
  • D column: Hour
How can I calculate day of the year according to these column of xls file?
Sincerely...

Accepted Answer

jonas
jonas on 17 Aug 2018
Edited: jonas on 17 Aug 2018
You don't really need the hour of day.
data=xlsread('Lat30.xlsx');
date=datetime(data(:,1:3));
d=day(date,'dayofyear');

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!