Calendar in the terminal

Hello, good evening, I am using the cal command in the terminal to obtain the calendar of a specific year, for example cal 1952. And it gives me all the months of the year, up to this point without problems, but… when I want a year before Christ it responds ‘order not found’ Search with ncal 150 or ncal -150 or with cal 150 B.C. and it always responds with ‘order not found’. Does anyone know how to request it?

Hi @juancuyo,

Interesting question…
From what I have found, plain Bash cannot produce calendars or dates before Christ (BC/BCE). Years ≤ 0 are not supported. Achieving this requires scripting with additional tools such as awk, perl, or a higher-level language.

GNU cal / ncal

  • Uses the proleptic Gregorian calendar by default
  • Supports years 1 and later only
  • There is no year 0 in traditional BC/AD dating
  • Negative years are not accepted

As a workaround, I found the following Python example:

python3 - << 'EOF'
import calendar

year = -149  # -149 corresponds to 150 BC using astronomical year numbering
calendar.setfirstweekday(calendar.MONDAY)
print(calendar.TextCalendar(calendar.SUNDAY).formatyear(year))
EOF

Notes:

  • This uses a proleptic Gregorian calendar
  • It is mathematically consistent but not historically authentic
  • This means the calendar rules are extended backward in time, even though the Gregorian calendar did not exist before Christ

Hope this helps to find your way.

Does anybody really know what time it is?
Does anybody care?

Seeing as the Gregorian Calendar wasn’t in use prior to 1582, seems to me everything before that (in cal) will be useless. 300 years went missing in the conversion from Julian to Gregorian.

Hello, good afternoon, thank you for your response muzqs, I thought I was requesting the year incorrectly, but there is simply no way to request it, my curiosity arose when reading historical topics, greetings and thank you again.