da_atotime.inc

References to this file elsewhere.
1 subroutine da_atotime(date_char, st)
2  
3    !-----------------------------------------------------------------------
4    ! Purpose: TBD
5    !-----------------------------------------------------------------------
6 
7    implicit none
8 
9    character(len=*), intent(in) :: date_char
10    real,              intent(out) :: st
11   
12    integer                :: ccyy,mo,dd,hh,mi,ss,i
13    integer, dimension(12) :: mmday
14  
15    mmday=(/31,28,31,30,31,30,31,31,30,31,30,31/)
16   
17    read(date_char(1:19),'(i4,1x,4(i2,1x),i2)') &
18         ccyy, mo, dd, hh, mi, ss
19   
20    if (mod(ccyy,4) == 0) then
21       mmday(2) = 29
22       if (mod(ccyy,400) == 0) then
23          mmday(2) = 29
24       else if (mod(ccyy,100) == 0) then
25          mmday(2) = 28
26       end if
27    end if
28   
29    dd=dd+365*(ccyy-2000)
30 
31    do i=1,mo-1
32       dd=dd+mmday(i)
33    end do
34   
35    st = real(ss) &
36       + 60.0*(real(mi) &
37       + 60.0*(real(hh) &
38       + 24.0* real(dd)))
39 
40 end subroutine da_atotime
41 
42