      integer function moday (ny, nm)

c  returns the number of days in a given month (1 - 12)
c     year given as 1983 !

      logical leapyear
      integer ndays(12) /31,28,31, 30,31,30, 31,31,30, 31,30,31/
      character*6 chival

      if (nm .ge. 1 .and. nm .le. 12) then
        moday = ndays (nm)
        if (nm .eq. 2 .and. leapyear(ny)) moday = 29
      else
        call warn (' Moday:'//chival(nm)
     2                   //' is not a valid month number')
        moday = 0
      end if
      return
      end
