Blinking snake



grj - Gregorian calendar to Julian calendar conversion


grj [-h?MvbIpV] <date(s)> ... ...


This program converts input dates in the Gregorian calendar into corresponding dates in the Julian calendar. Input dates are assumed to be in the “Gregorian Proleptic Calendar”, which is also known as the “Gregorian Astronomical Calendar” [or “Gregorian Astronomical System”]. In this system, there is a Year 0, and years before Zero are negative [indicated with “-” signs]. Note that leap years in this system follow the same rules on either side of Year 0, and that Year 0 Gregorian is a leap year.

Note that in the Julian Calendar, the year 1 BC is a leap year.

There are a number of fictions subscribed to for the purposes of this program. The Gregorian calendar is held to be a flat line with zero deviation; it is assumed to have always been in effect and that it always will be, with no holes (in particular, there are no “short” months in this fictitious calendar, such as October of 1583 or September of 1752, which are the result of changing from public use of the Julian Calendar to the public use of the Gregorian Calendar). The Julian Calendar into which input dates are cast is also assumed to be different from the Gregorian Proleptic Calendar by a regular, calculable amount, again with no gaps or other irregularities. In particular, years in both systems are deemed to always have begun on 1 January, despite the fact that in England, at the very least, years before 1752 officially began on 25 March in the Julian Calendar. What this means, of course, is that the question “what year is it?” depends mostly upon what year it is in whichever calendar happens to be in public use at the time; a calendar that attempts to provide a continuous set of dates covering years operating by differing rules is neither Gregorian nor Julian, but some mixture, and is ethnography, not chronology.

Note that the slope of the deviation of the Julian Calendar from the Gregorian Proleptic Calendar is determined solely by two factors;


-h or -?
Print a help message and die; -h goes to stderr, -? goes to stdout.
Print this manual page and die.
Verbose mode; -vv for very verbose. With just -v, grj prints the date requested and the derived date, plus the day of the year, the Style of calendar, the length of the years for both dates, and the deviation in days from the Gregorian calendar. With -vv, it dumps everything it knows about the output date.
“BC” mode; outputs the year as “0001 BC” instead of “0000,” or “4713 BC” instead of “-4712.”
Instead of reading dates for conversion from the command line, read from the specified file. <File> may be a real file, or it can be stdin or /dev/tty. If you specify one of the latter two, you should probably use the next option; naturally, ^D indicates EOF when grj is interactive.
If grj is reading from stdin or /dev/tty, and you have specified this option, it will prompt (“grj: ”) before reading.
Print version date and die.


% grj
28 July 1987
% grj 1/1/1
3 Jan 0001
% grj 11/8/-754
15 Nov 0755 BC
% grj 3/25/43000
12 Apr 42999
% grj 2/29/1987
grj:  There ain’t no such animal (2/29/1987).
% grj -v
[ 04 Mar 1990 ] {#063} Gregorian Style (365 days) is
[ 19 Feb 1990 ] {#050} Julian Style (365 days). [Deviation 13].
%  grj -vv 3/6/1997
[ 06 Mar 1997 ] {#065} Gregorian Style (365 days) is
[ 21 Feb 1997 ] {#052} Julian Style (365 days). [Deviation 13].
         Output:  Thursday, February 21, 1997 [52] Julian Style, Year length 365
           Time:  12:00:00  zone MDT, GMT offset 25200, Daylight Time
  Julian Period:  Period #+0, JPyear 6710, Day 2450514.00, Deviation 13
     Dominicals:  Julian Dominical Letter F Tuesday; on Jan 1, F Tuesday
               :  Gregorian Dominical Letter E Wednesday; on Jan 1, E Wednesday
          Lunar:  Gregorian Epact 21, Lunar age 13
         Cycles:  Julian Golden Number 3, Cycle of Indiction 5, Solar Cycle 18
      Cartesian:  Latitude 40.7667 Longitude -111.883
        GM Time:  0.00000000 = 00 hours 00 minutes 00 seconds
    GM Sidereal:  0.00000000 = 00 hours 00 minutes 00 seconds
 Local Sidereal:  0.00000000 = 00 hours 00 minutes 00 seconds
          Flags:  fffffffa
     More Flags:  00000000


The ? in the -? must be escaped (preceded by a \) to prevent interpretation as a metacharacter by some shells.

Only one input date format is allowed.


ncal(I), bxy(I), boxdate(I), easter(I), jug(I)




Ivan Van Laningham. If you would like the C source, email me.

Previous Page
Table of Contents
Next Page

Main web site:

Valid HTML 4.01 Transitional