-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcvtdate.f
67 lines (67 loc) · 1.66 KB
/
cvtdate.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
subroutine cvtdate(nyr,nmo,ndy,time,ndate,jdate,ly2k)
c
c-----CAMx v4.02 030709
c
c CVTDATE converts year, month, day to calender (YYMMDD) and
c julian (YYJJJ) dates
c
c Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
c ENVIRON International Corporation
c
c Modifications:
c 11/05/01 Added Y2K flag and conversion to Julian date
c
c Input arguments:
c nyr year (YYYY)
c nmo month (MM)
c ndy day (DD)
c time time (HHMM)
c
c Output arguments:
c time time (HHMM)
c ndate calender date (YYMMDD)
c jdate Julian date (YYJJJ)
c ly2k Y2K flag
c
c Routines Called:
c JULDATE
c
c Called by:
c STARTUP
c
logical ly2k
dimension nday(12)
data nday/31,28,31,30,31,30,31,31,30,31,30,31/
c
c-----Entry point
c
ly2k = .false.
if (nyr.ge.2000) ly2k = .true.
nday(2) = 28
if (mod(nyr,4).eq.0) then
nday(2) = 29
endif
c
c-----Convert hour 2400 to 0000 of the following day
c
if (time.ge.2400.) then
time = time - 2400.
ndy = ndy + 1
if (ndy.gt.nday(nmo)) then
ndy = 1
nmo = nmo + 1
if (nmo.gt.12) then
nmo = 1
nyr = nyr + 1
endif
endif
endif
c
c-----Create calendar and Julian date stamps
c
ndate = 10000*mod(nyr,100) + 100*nmo + ndy
jdate = ndate
call juldate(jdate)
c
return
end