	subroutine cnv_date(indate,outdate,ntype)
c
c	converts rdi dates to conventional or inverse
c
c	ntype=1;  real-time (Proteus) RDI date 
c	ntype=2;  internal memory RDI date 
c	ntype=8;  ftp hourly met date 
c
c	ntype = negative, then do inverse
c
c
	integer indate(5),outdate(5),tmpdate(5)
	if(ntype.eq.1) then
	outdate(1)=0
	outdate(2)=0
	do n=1,3
	outdate(n+2)=indate(n)
	end do
	elseif(ntype.eq.2) then
        outdate(5)=indate(5)
        outdate(4)=indate(1)
        outdate(3)=indate(2)
        outdate(2)=indate(4)
        outdate(1)=indate(3)
	elseif(ntype.eq.8) then
        tmpdate(5)=indate(1)
        tmpdate(4)=indate(2)
        tmpdate(3)=indate(3)
        tmpdate(2)=indate(5)
        tmpdate(1)=indate(4)
	call sub_date(tmpdate,outdate)
	elseif(ntype.eq.-1) then
	outdate(1)=0
	outdate(2)=0
	do n=3,5
	outdate(n)=indate(n-2)
	end do
	elseif(ntype.eq.-2) then
        outdate(5)=indate(5)
        outdate(1)=indate(4)
        outdate(2)=indate(3)
        outdate(3)=indate(1)
        outdate(4)=indate(2)
	elseif(ntype.eq.-8) then
        tmpdate(4)=indate(1)
        tmpdate(5)=indate(2)
        tmpdate(3)=indate(3)
        tmpdate(2)=indate(4)
        tmpdate(1)=indate(5)
	call sub_date(tmpdate,outdate)
	endif
	return
	end


