












  SUBROUTINE tool_decompdate(date,jj,mm,aaaa,hh,minu,sec)
      use Agrif_Types, only : Agrif_tabvars

      implicit none

#include "Param_BeforeCall_tool_decompdate.h"
      CHARACTER(19), intent(in) :: date
      INTEGER, intent(out) :: jj
      INTEGER, intent(out) :: mm
      INTEGER, intent(out) :: aaaa
      INTEGER, intent(out) :: hh
      INTEGER, intent(out) :: minu
      INTEGER, intent(out) :: sec

   !&E---------------------------------------------------------------------
   !&E                 ***  ROUTINE tool_decompdate  ***
   !&E
   !&E ** Purpose : decompose a date entered as a 19-character string
   !&E              with format "yyyy/mm/dd hh:mm:ss"
   !&E              into integers corresponding to the day (dd), month (mm),
   !&E              year (yyyy), hour (hh), minute (minu) and second (sec)
   !&E
   !&E ** Description :
   !&E
   !&E ** Called by : meteo, tool_datosec, main, step
   !&E
   !&E ** External calls : 
   !&E
   !&E ** Used ij-arrays : 
   !&E
   !&E ** Modified variables : jj, mm, aaaa, hh, minu, sec
   !&E
   !&E ** Reference :
   !&E
   !&E ** History :
   !&E       !  2004-08-16
   !&E
   !&E---------------------------------------------------------------------
   !! * Modules used

                


   !! * Arguments
                                          
                                                            

   !! * Local declarations
                                          
      LOGICAL :: cont
                                          
      CHARACTER(2) :: mois
                                                                    
                                                                 
                                                                 
                           
      CHARACTER(2), dimension(1:12) :: tab_mois = (/'01','02','03','04',&
     &'05','06','07','08','09','10','11','12'/)
                                       
      INTEGER :: i

   !!----------------------------------------------------------------------
   !! * Executable part

   READ(date,800)aaaa,mois,jj,hh,minu,sec
   cont = .TRUE.
   i = 1

   DO WHILE(cont.AND. i <= 12)
     IF(tab_mois(i) == mois) THEN
       cont = .FALSE.
     ELSE
       i = i +1
     ENDIF
   ENDDO

   IF(i <= 12) THEN
     mm = i
   ELSE
     PRINT*,'erreur tool_decompdate : impossible de determiner le mois'
     STOP
   ENDIF

800 FORMAT(i4,1x,a2,1x,i2,1x,2(i2,1x),i2)

  END SUBROUTINE tool_decompdate
