merge standard release WRF/WPS V3.0.1.1 into wrffire
[wrffire.git] / WPS / ungrib / src / build_hdate.F
blob33c202c2162e1b06d031b157044b4b3deb8e3ca1
1       subroutine build_hdate(hdate, iyr, imo, idy, ihr, imi, isc)
3 ! PURPOSE: 
4 !      From the Year, Month, Day, Hour, Minute, and Second values, 
5 !      creates a 19-character string representing the date, in the 
6 !      format:  "YYYY-MM-DD hh:mm:ss"
8 ! INPUT:
9       integer iyr     ! year (e.g., 1997, 2001)
10       integer imo     ! month (01 - 12)
11       integer idy     ! day of the month (01 - 31)
12       integer ihr     ! hour (00-23)
13       integer imi     ! minute (00-59)
14       integer isc     ! second (00-59)
15 ! OUTPUT:
16       character*(*) hdate ! 'YYYY-MM-DD hh:mm:ss'
18 ! LOCAL:
19       integer i  ! Loop counter.
20       integer hlen ! Length of hdate string
22       hlen = len(hdate)
24       if (hlen.eq.19) then
25          write(hdate,19) iyr, imo, idy, ihr, imi, isc
26  19      format(i4,'-',i2.2,'-',i2.2,'_',i2.2,':',i2.2,':',i2.2)
28       elseif (hlen.eq.16) then
29          write(hdate,16) iyr, imo, idy, ihr, imi
30  16      format(i4,'-',i2.2,'-',i2.2,'_',i2.2,':',i2.2)
32       elseif (hlen.eq.13) then
33          write(hdate,13) iyr, imo, idy, ihr
34  13      format(i4,'-',i2.2,'-',i2.2,'_',i2.2)
36       elseif (hlen.eq.10) then
37          write(hdate,10) iyr, imo, idy
38  10      format(i4,'-',i2.2,'-',i2.2)
39       endif
41       return
42       end