
      SUBROUTINE cnum2date (datum, date)
  
      implicit none
  
      CHARACTER datum*10
      INTEGER date              
      INTEGER ddate             
      INTEGER ntage             
      INTEGER year,mon,day,std,min
      INTEGER dmon(13),smon(13)
  
      DATA dmon/0,31,59,90,120,151,181,212,243,273,304,334,365/
      DATA smon/0,31,60,91,121,152,182,213,244,274,305,335,366/
      INTEGER       i
      LOGICAL       schalt
     
      schalt=.false.
      datum='??????????'
  
      year=1996
      ntage=366
      ddate=date
  
      DO WHILE (ddate .GE. ntage*24*60)
  
        year=year+1
        IF (MOD(year-1,4) .EQ. 0 .AND. (MOD(year-1,100) .NE. 0 .OR. 
     &    MOD(year-1,400) .EQ. 0)) THEN
          ddate=ddate-(366*24*60)
        ELSE
          ddate=ddate-(365*24*60)
        END IF
  
        IF (MOD(year,4) .EQ. 0 .AND. (MOD(year,100) .NE. 0 .OR. 
     &    MOD(year,400) .EQ. 0)) THEN
          ntage=367
        ELSE
          ntage=366
        END IF
  
      END DO
!
      schalt=.false.
      IF (MOD(year,4) .EQ. 0 .AND. (MOD(year,100) .NE. 0 .OR. 
     &  MOD(year,400) .EQ. 0)) schalt=.true.
  
      IF (year .LT. 2000) THEN
        year=year-1900
      ELSE
        year=year-2000
      END IF
  
      IF (schalt) THEN
        ddate=MOD(ddate,(367*24*60))
        DO i=2,13
          IF (ddate .GE. 24*60*(smon(i-1)+1) .AND. ddate .LT. 24*60*
     &      (smon(i)+1)) mon=i-1 
        END DO
  
        day=(ddate-smon(mon)*24*60)/(24*60)
        std=(ddate-(smon(mon)+day)*24*60)/60
        min=(ddate-(smon(mon)+day)*24*60)-std*60
      ELSE
        ddate=MOD(ddate,(366*24*60))
  
        DO i=2,13
          IF (ddate .GE. 24*60*(dmon(i-1)+1) .AND. ddate .LT. 24*60*
     &      (dmon(i)+1)) mon=i-1
        END DO
  
        day=(ddate-dmon(mon)*24*60)/(24*60)
        std=(ddate-(dmon(mon)+day)*24*60)/60
        min=(ddate-(dmon(mon)+day)*24*60)-std*60
  
      END IF
  
      IF (min .EQ. 60) THEN
        min=0
        std=std+1
        IF (std  .EQ.  24) THEN
          std=0
          day=day+1
        END IF
      END IF
  
      WRITE (datum(1:2),10) year
      WRITE (datum(3:4),10) mon
      WRITE (datum(5:6),10) day
      WRITE (datum(7:8),10) std
      WRITE (datum(9:10),10) min
  
   10 FORMAT(i2.2)
   
      RETURN
      END

