Tag Archives: unix calendar command

2012 Calendar vs 1752 Calendar in Unix and Leap Years

Happy Ground Hog Day all! This February is the month that gets an extra day added during the leap year of 2012. The Unix ‘cal’ command in Solaris 10 will show you how things can get screwed up if the leap days aren’t added to the calendar every 4 years.

 sunbox% cal 9 1752
 September 1752
 S  M Tu  W Th  F  S
       1  2 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

Notice anything missing? The calendar we use today had September 1752 adjusted by the British after changing from the Julian calendar to the Gregorian calendar. And you thought changing to a new operating system can create havoc!

From the cal manpage in Solaris 10:

An unusual calendar is printed for September 1752. That is
the month 11 days were skipped to make up for lack of leap
year adjustments. To see this calendar, type:

cal 9 1752

If you want to see the calendar for the current month and year, just type cal.

Type cal 3 2012 to see the calendar for March 2012. If you just type cal 3, you will see the full 12 month calendar for the year 3. 2009 years ago, way before Unix Time.Type cal 2012 in the Unix command terminal and you’ll get the full 12 month calendar for the year 2012.

Unix command cal 2012 in Solaris