da_advance_cymdh.inc
References to this file elsewhere.
1 subroutine da_advance_cymdh (start_date, dh, end_date)
2
3 !-----------------------------------------------------------------------
4 ! Purpose: TBD
5 !-----------------------------------------------------------------------
6
7 implicit none
8
9 character (len=10), intent(in) :: start_date ! In date (ccyymmddhh).
10 integer, intent(in) :: dh ! Period to advance (-ve for past).
11 character (len=10), intent(out) :: end_date ! Out date (ccyymmddhh).
12
13 integer :: ccyy, mm, dd, hh
14
15 read(start_date(1:10), fmt='(i4, 3i2)') ccyy, mm, dd, hh
16
17 hh = hh + dh
18
19 do while (hh < 0)
20 hh = hh + 24
21 call da_change_date (ccyy, mm, dd, -1)
22 end do
23
24 do while (hh > 23)
25 hh = hh - 24
26 call da_change_date (ccyy, mm, dd, 1)
27 end do
28
29 write(unit=end_date(1:10), fmt='(i4.4, 3i2.2)') ccyy, mm, dd, hh
30
31 end subroutine da_advance_cymdh
32
33