```
W3FS26

The W3FS26 routine computes year (4 digits), month, day,
day of week, day of year from julian day number.
This subroutine will work from 1583 A.D. to 3300 A.D.

USAGE:  CALL W3FS26(JLDAYN,IYEAR,MONTH,IDAY,IDAYWK,IDAYYR)

Input variables:
JLDAYN ARG LIST  INTEGER   JULIAN DAY NUMBER

Output variables:
IYEAR  ARG LIST  INTEGER   YEAR  (4 DIGITS)
MONTH  ARG LIST  INTEGER   MONTH
IDAY   ARG LIST  INTEGER   DAY
IDAYWK ARG LIST  INTEGER   DAY OF WEEK (1 IS SUNDAY, 7 IS SAT)
IDAYYR ARG LIST  INTEGER   DAY OF YEAR (1 TO 366)

REMARKS:
A JULIAN DAY NUMBER CAN BE COMPUTED BY USING ONE OF THE
FOLLOWING STATEMENT FUNCTIONS. A DAY OF WEEK CAN BE COMPUTED
FROM THE JULIAN DAY NUMBER. A DAY OF YEAR CAN BE COMPUTED FROM
A JULIAN DAY NUMBER AND YEAR.

IYEAR (4 DIGITS)

JDN(IYEAR,MONTH,IDAY) = IDAY - 32075
+ 1461 * (IYEAR + 4800 + (MONTH - 14) / 12) / 4
+ 367 * (MONTH - 2 - (MONTH -14) / 12 * 12) / 12
- 3 * ((IYEAR + 4900 + (MONTH - 14) / 12) / 100) / 4

IYR (4 DIGITS) , IDYR(1-366) DAY OF YEAR

JULIAN(IYR,IDYR) = -31739 + 1461 * (IYR + 4799) / 4
-3 * ((IYR + 4899) / 100) / 4 + IDYR

DAY OF WEEK FROM JULIAN DAY NUMBER, 1 IS SUNDAY, 7 IS SATURDAY.

JDAYWK(JLDAYN) = MOD((JLDAYN + 1),7) + 1

DAY OF YEAR FROM JULIAN DAY NUMBER AND 4 DIGIT YEAR.

JDAYYR(JLDAYN,IYEAR) = JLDAYN -
(-31739+1461*(IYEAR+4799)/4-3*((IYEAR+4899)/100)/4)

THE FIRST FUNCTION WAS IN A LETTER TO THE EDITOR COMMUNICATIONS
OF THE ACM  VOLUME 11 / NUMBER 10 / OCTOBER, 1968. THE 2ND
FUNCTION WAS DERIVED FROM THE FIRST. THIS SUBROUTINE WAS ALSO
INCLUDED IN THE SAME LETTER. JULIAN DAY NUMBER 1 IS
JAN 1,4713 B.C. A JULIAN DAY NUMBER CAN BE USED TO REPLACE A
DAY OF CENTURY, THIS WILL TAKE CARE OF THE DATE PROBLEM IN
THE YEAR 2000, OR REDUCE PROGRAM CHANGES TO ONE LINE CHANGE
OF 1900 TO 2000. JULIAN DAY NUMBERS CAN BE USED FOR FINDING
RECORD NUMBERS IN AN ARCHIVE OR DAY OF WEEK, OR DAY OF YEAR.

W3lib.tar
Library contains Fortran 90 decoder/encoder
routines for GRIB edition 1. (Fortran90)
Date posted: 2/22/2007

```