$32,232 to go to meet our Challenge Grant, by December 1st. Your gift now will count twice!
Click here to advertise on CatholicCulture.org

Do You Have a Date?

By Dr. Jeff Mirus (bio - articles - email) | Apr 19, 2012

If you’re working with “small” dates as a programmer, you might express today’s date as 2012-04-19. You might use that date as an identifier in a database if you were programming a system that would bring up particular information about particular dates. I’m talking about our “day” display in the liturgical year section.

Now let’s further suppose you wanted to count the number of times people viewed the pages for different dates. You might make up an additional little data table (call it “hit_counter”) in which a “count” field would be incremented each time a particular day was loaded. The correct record in that new table could be identified by the “small date”.

Now let’s add another supposition. You’ve already programmed a hit_counter system for your entire website, and the ID fields for every other kind of information on the site are simple numbers. The forty-thousandth news story has an ID of 40000. The thirty-ninth City Gates entry has an ID of 39. Each ID is keyed to its proper data table, of course. It works like a charm!

But when you add the liturgical days to this counting system, you forget something. You forget that the identifier for your days is a date, like 2012-04-19. And because you’ve forgotten this, you pass that value to your tried-and-true hit_counter routine as if it were a number, just like all the others. And then you wonder why the total hits for the various days of the year begin to look a little strange.

And you wonder. And you wonder some more. You pull your hair because you know the code works everywhere else. You start giving your email correspondents short shrift. You are late for dinner. You yell at your wife and kids.

Until, all at once, you realize the obvious.

When 2012-04-19 is passed as a number, it is passed as 2012 minus 4 minus 19. In other words, it is passed as 1989. And guess what? 2011-04-18 is also passed as 1989. As is 2010-09-12. Moreover, 2013-01-23 will soon enough be passed as 1989. And many other dates besides.

But, hey, I figured this out today, didn’t I?

And nobody died.

An appeal from our founder, Dr. Jeffrey Mirus:

Dear reader: If you found the information on this page helpful in your pursuit of a better Catholic life, please support our work with a donation. Your donation will help us reach seven million Truth-seeking readers worldwide this year. Thank you!

Our Fall Campaign
Progress toward our year-end goal ($116,671 to go):
$150,000.00 $33,328.98
78% 22%
Sound Off! CatholicCulture.org supporters weigh in.

All comments are moderated. To lighten our editing burden, only current donors are allowed to Sound Off. If you are a donor, log in to see the comment form; otherwise please support our work, and Sound Off!

Show 1 Comments? (Hidden)Hide Comments
  • Posted by: jjen009 - Apr. 20, 2012 12:11 AM ET USA

    And here I thought it was only me who made programming errors like that!

Fall 2014 Campaign
Subscribe for free
Shop Amazon
Click here to advertise on CatholicCulture.org

Recent Catholic Commentary

Putting Our Best Foot Forward 0 hours ago
Contentious Spirits, Beware! 22 hours ago
And here's another very old story: the secular media don't understand Catholic affairs October 29
How not to be persuasive October 29
Francis the Man, Francis the Pope October 28

Top Catholic News

Most Important Stories of the Last 30 Days
Key synod report calls for 'gradualism' in Church response to irregular family situations CWN - October 13
As synod concludes, bishops issue message, approve document; Pope weighs in CWN - October 20
Synod of Bishops opens with Mass in St. Peter’s Basilica CWN - October 6