Blinking snake



jug - Julian calendar to Gregorian calendar conversion


jug [-h?MvbIpV] <mm/dd/yyyy> <mm/dd/yyyy> ... ...


This program converts input dates in the Julian style calendar into corresponding dates in the Gregorian style calendar. Output dates are actually 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; 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.

Input dates may be either in “BC” format or in Astronomical format; for BC format, simply follow the year of the input date with the letter “b”, instead of the “-” preceding the year, when input years are before 1 CE.

The Julian calendar is held to be a flat line with zero deviation (it is our reference line); it is assumed to have always been in effect and that it always will be, with no holes (such as the mess the Romans made of things between 45 BC and 8 CE [what do you expect from a bunch of gladiators?]). This reference calendar is the “Julian Proleptic Calendar.” In particular, years in both the Julian and Gregorian 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.

No allowance is made for the slowing of the rotation of the Earth over time, but then, since we are dealing with no division of time smaller than a day, there doesn’t need to be.


-h or -?
Print a help message and die. -h goes to stderr, and -? goes to stdout.
Print this manual page and die.
Verbose mode; -vv for very verbose. With just -v, jug 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.” This isn’t true “Gregorian Proleptic,” but it’s sometimes convenient.
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 jug is interactive.
If jug is reading from stdin or /dev/tty, and you have specified this option, it will prompt (“jug: ”) before reading.
Print the version date and die.


% jug
22 Aug 1987
% jug 8/9/1987
22 Aug 1987
% jug 1/3/1
1 Jan 0001
% jug 11/8/-755
1 Nov -0755
% jug 11/8/755b
2 Nov -0754
% jug -b 11/8/755b
2 Nov 0755 BC
% jug 2/29/1900
13 Mar 1900
% jug 1/1/4713b
23 Nov -4713
% jug -v
[ 04 Mar 1990 ] {#063} Julian Style (365 days) is
[ 17 Mar 1990 ] {#076} Gregorian Style (365 days). [Deviation 13].
% jug -vv 3/6/1997
[ 06 Mar 1997 ] {#065} Julian Style (365 days) is
[ 19 Mar 1997 ] {#078} Gregorian Style (365 days). [Deviation 13].
         Output:  Wednesday, March 19, 1997 [78] Gregorian Style, Year length 365
           Time:  00:00:00  zone MDT, GMT offset 25200, Daylight Time
  Julian Period:  Period #+0, JPyear 6710, Day 2450527.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 10
         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:  f8fffffa
     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; it must be adhered to strictly. But the input year may be entered as ‘yyyy’, ‘-yyyy’ or ‘yyyyb’ (see the examples). the ‘yyyy’ format (‘1988’) indicates a year in the range 1 CE to MAXINT CE; the ‘yyyyb’ format (‘4713b’) indicates a year in the range MAXINT to 1 BC (no year 0); and the ‘-yyyy’ format (‘-4712’) indicates a year in the range -MAXINT to 0 in the “Julian Proleptic Calendar.” Using the “-b” option translates the output “Gregorian Proleptic” years into years BC; that is, “-4712” in gives you “4713 BC” out.


ncal(I), dhour(I), easter(I), grj(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