An up-to-date version of this and other files can be found in my CommandLineTools project on GitHub.

Cal is a little program I wrote when I needed it for a demo. Is is quite similar to the Unix command cal. It displays a simple calendar.


cal [-13msyeh?] [[month] year]


-1 Print one month only (default).
-3 Print the previous month, the selected month and the next month on one row.
-m Print a calendar where Monday is the first day of the week, as opposed to Sunday.
-s Print a calendar where Sunday is the first day of the week (default).
-y Display a calendar for the entire year.
-e Use English month and day names. Cal will otherwise use the local month and day names.
-h, -? Display a simple help screen.

A single parameter specifies the year (1 – 9999) to be displayed. The year must be fully specified: cal 89 will not display a calendar for 1989 or 2089, but for the year 89. Two parameters denote the month and year, in that order. The month is a number between 1 and 12.

A year starts on January 1.


Compilation is straighforward.

An older version required my Console unit, but that posed problems when text was redirected to a text file or some other stream (IOW, there is a bug in Console.pas I could not correct yet). Since Console was only used to reverse colours for the display of the current date, I used direct Windows API calls to achieve this, in the new ReverseColors procedure.


Cal is freeware. All rights are reserved. Its code is provided as is, expressly without a warranty of any kind. You use it at your own risk

I hope this code is useful to you. If you use some of it, please credit me. If you modify or improve the program, please send me the modifications.

I may improve or enhance Cal myself, and I will try to post changes here. But this is not a promise. Please don’t request features.

Rudy Velthuis

Standard Disclaimer for External Links

These links are being provided as a convenience and for informational purposes only; they do not constitute an endorsement or an approval of any of the products, services or opinions of the corporation or organization or individual. I bear no responsibility for the accuracy, legality or content of the external site or for that of subsequent links. Contact the external site for answers to questions regarding its content.

Disclaimer and Copyright

The coding examples presented here are for illustration purposes only. The author takes no responsibility for end-user use. All content herein is copyrighted by Rudy Velthuis, and may not be reproduced in any form without the author's permission. Source code written by Rudy Velthuis presented as download is subject to the license in the files.

Back to top