OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
ymd2day.f
Go to the documentation of this file.
1 c ==============================================================
2 c Computes Day of Year from Gregorian date
3 c
4 c year I I*4 4-digit year
5 c month I I*4 month number (1 - 12)
6 c dayOfMonth I I*4 day of month
7 c dayOfYear O I*4 day of year
8 c
9 c BA Franz, GSC, 12/96
10 c ==============================================================
11 
12  subroutine ymd2day(year,month,dayOfMonth,dayOfYear)
13 c
14  implicit none
15 c
16  save startofmonth
17 c
18  integer*4 year
19  integer*4 month
20  integer*4 dayOfMonth
21  integer*4 dayOfYear
22  integer*4 leap
23 c
24  integer*4 startOfMonth(12,2)
25 c
26  data startofmonth / 0,31,59,90,120,151,181,212,243,273,304,334,
27  . 0,31,60,91,121,152,182,213,244,274,305,335 /
28 c
29  if (mod(year,4) .eq. 0) then ! Not valid for year 2100
30  leap = 2
31  else
32  leap = 1
33  endif
34 c
35  dayofyear = startofmonth(month,leap) + dayofmonth
36 c
37  return
38  end
subroutine ymd2day(year, month, dayOfMonth, dayOfYear)
Definition: ymd2day.f:13