cbegin documentation c library date: 28-nov-1983 c function name: doy_date c source location: dra0:[lee.netlib]doydate.for c function type: integer*4 c function reference: i = doy_date(yrdoy) c purpose: to convert the date in the form yyddd to the c form mmddyy c c arguments: c name type i/o definition c ---- ---- --- ---------- c yrdoy integer*4 i date in form yyddd c c returned function values: date in form mmddyy c c restrictions: 1) doy_date must be typed integer*4 in calling program. c 2) a "1900" year is assumed c c error conditions: none c c entry points: none c c external references: idysyr - returns number of days in a given year c c development history: c developed 29-nov-1983, bcss/barry lee c cend documentation c integer*4 function doy_date(yrdoy) implicit integer*4 (a-z) integer m(12) data m/31,59,90,120,151,181,212,243,273,304,334,365/ yr=yrdoy/1000 doy=yrdoy-1000*yr leap=idysyr(yr+1900)-365 do i=1,12 if(i.lt.2)then day=m(i) else day=m(i)+leap end if if(doy.le.day)then mon=i if(mon.eq.1)then j=0 else j=m(i-1) if(mon.gt.2)j=j+leap end if day=doy-j doy_date=yr+100*(day+100*mon) return end if end do doy_date=0 return end