The Killer C++ Date Class v5.0

The "Killer" Date class is the work of about 8 people, who've never met. It started as a simple C++ class to represent calendar dates, and has grown to what is probably the most baroque example of the form. It handles all dates from 2713BC to the distant future.

When I first wrote this page (1997), the class was still relevant. Even when I last revised in (2011, adding bootstrap support), it might have been still useful. But now, in 2024, I doubt anyone would use it. Modern C++ has much better date/time libraries, and the Killer Date class is now mostly of historical interest.

So, I'm just going to add the history here. Note the Linus Torvalds first announced his Linux project (and sought help on it), on August 25, 1991, so this beats it by about two months. There are more fun facts in the DATECL50.TXT file in the main zip file.

History

  • In the beginning, Steve Marcus (CIS 72007,1233) posted a basic date manipulation/arithmetic class produced with Borland C++ 2.0 in the BPROGB forum, with a request for suggestions and enhancements. This was on 6/19/91.
  • A rather enterprising gentleman by the name of Eric Simon (CIS 70540,1522) accepted the challenge, and produced a new and improved version in the course of a project he was developing at work. He contributed the results to the forum on 6/29/91, also inviting enhancements and comments.
  • About that time yet another enterprising gentleman named Christopher Hill developed a need for a universal date conversion routine for use in a business project he was developing as well. Browsing the same forum, he encountered Eric's class, which provided much of the functionality he needed - the basic julian-gregorian and day of week conversion algorithms - relieving him of the task of researching or re-inventing them. Eric had also added overloaded + and - operators for incrementing date objects by integer days, as well as several print functions. Chris needed additional features for his implementations, thus was born versions 3.0 and 3.1(Hill & Simon).
  • Well, almost a year later I sent out an SOS for a date class so I didn't have to re-invent the wheel and lo-and-behold Chris responded. Thus begins the saga of version 4.0! I would like to take this opportunity to do a little witnessing: I looked all over for a date class that would suit my needs! I reviewed many implementations from strangers and friends alike and I am here to tell ya' folks, "It don't 'git no bedder 'n dis!" This class is VERY cool! Now I'm not trying to say that there's no more room for enhancements (I'd really be crazy then!), but I am saying that if your looking for a GOOD date class (I'd say commercial quality because I have yet to see a commercial product that implemented a date class to my satisfaction!) then this is it! So jump in and add to it, make it better and we'll SAVE THE WORLD! (Ok, so I got a little carried away at the end. Just a little...)
  • No, but really... This is a truly pleasing example of co- operation among professionals, and an "object" study in the code reusability of OOP, resulting in three releases of one class within a single month by three different analysts who have never met, and yet another upgrade almost a year later by a fourth analyst (myself) and none of us have yet to meet! Chris thanks Steve and Eric for their inspiration and generosity, and I thank all three as well.
  • Now, I'm going to take a little break from the action and I believe any of us would welcome further comments, suggestions and enhancements as well.
  • Good luck! May the quest for the perfect date class continue!
Charles Price (March 27, 1992)
  • Well, I must say, this is quite an impressive Date class!!! And I must agree with Mr. Kenneth...it's probably one of the BEST (if not the best) Date class I've seen so far (but then again, I've not seen too many!).
  • However, I thought it really could take more advantage of some of the better features of C++ (ie. encapsulation!). Thus, I decided to take on the challenge set forth by the aforementioned 'Date'-crazed group.
  • My changes are listed below in the Version 4.2 section. Please let me know of any updates/changes that will happen in the future!
Trí Minh Ly :) (March 13, 1993)
  • To continue where Charles & Trí leave off, the class sat idle for about 8 months, when suddenly in March of '93, three people, still all working independently, decided, almost simultaneously, to add their own modifications. Kenneth Argo got the ball rolling again, and then Trí Minh Ly kept it active with regular updates. During this time, I was toiling away, spending about two years, off & on, ripping out and replacing it's guts, while try to keep up with Tr 's updates.
James M. Curran (October 1, 1993)

KEY FEATURES

Portability

  • Works with Microsoft, Borland and others C++ compilers "out of the box"
  • Should work with any C++ based on ANSI C. (even those which aren't up to the ISO C++ draft standard.
  • Authors actively seek complete platform independence.

Robust

  • Format days as "January 1, 1997" or "1 January 1997" or "1-Jan-97" or "19970101" or others
  • Translates ASCII strings in any of the above forms.
  • ++, --, AddWeek, AddMonth, AddYear, construct dates any number of different ways, including such as "The last Tuesday on October of 1962".
  • Every date related function you'll ever need.

Affordable

  • Completely free!
  • May be used and distributed freely.
  • (may not be sold)

Download Here

  • date50.zip - Contains the date.cpp & datecl.h, plus project files for Borland (datecl.prj) and Microsoft (datecl.mak) compilers, with release notes & class reference as ASCII text files. (55K, zipped file)
  • dateax.zip - Contains release notes and class reference as formatted Word for Windows files, plus code samples (42K, zipped file)
  • All comments & questions should be send to me.
Copyright © 1998-2025 James M. Curran .
All rights reserved.