NCEPLIBS-bufr  11.7.0
 All Data Structures Files Functions Variables Pages
i4dy.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Convert a date-time with a 2-digit year to a date-time with
3 C> a 4-digit year
4 
5 C> This function converts a date-time with a 2-digit year (YYMMDDHH)
6 C> to a date-time with a 4-digit year (YYYYMMDDHH) using a windowing
7 C> technique.
8 C>
9 C> All 2-digit years greater than 40 are assumed to have a 4-digit
10 C> year beginning with 19 (i.e. 1941-1999), and all 2-digit years less
11 C> than or equal to 40 are assumed to have a 4-digit year beginning
12 C> with 20 (i.e. 2000-2040). If the input date-time already contains
13 C> a 4-digit year, then the function simply returns that value.
14 C>
15 C> @author J. Woollen
16 C> @date 1998-07-08
17 C>
18 C> @param[in] IDATE -- integer: Date-time in format of either YYMMDDHH
19 C> (2-digit year) or YYYYMMDDHH (4-digit year)
20 C> @returns i4dy -- integer: Date-time in format of YYYYMMDDHH (4-digit
21 C> year)
22 C>
23 C> <b>Program History Log:</b>
24 C> | Date | Programmer | Comments |
25 C> | -----|------------|----------|
26 C> | 1998-07-08 | J. Woollen | Original author |
27 C> | 1998-12-14 | J. Woollen | Modified to use 20 as the 2-digit year for windowing to a 4-digit year (00-20 ==> add 2000; 21-99 ==> add 1900) |
28 C> | 2003-11-04 | D. Keyser | Modified date calculations to stop using floating point arithmetic since this can lead to round off error and an improper result on some machines |
29 C> | 2018-06-29 | J. Ator | Changed 2-digit->4-digit year window range to (00-40 ==> add 2000; 41-99 ==> add 1900) |
30 C>
31  FUNCTION i4dy(IDATE)
32 
33  IF(idate.LT.10**8) THEN
34  iy = idate/10**6
35  IF(iy.GT.40) THEN
36  i4dy = idate + 19*100000000
37  ELSE
38  i4dy = idate + 20*100000000
39  ENDIF
40  ELSE
41  i4dy = idate
42  ENDIF
43 
44  RETURN
45  END
function i4dy(IDATE)
This function converts a date-time with a 2-digit year (YYMMDDHH) to a date-time with a 4-digit year ...
Definition: i4dy.f:31