Pressin’ it, 2.7-style

I have to say, I’m really liking the new WordPress 2.7 Dashboard. Very slick, intuitive, and sharp.

So, I have to relate an amusing story from last night.

My beautiful girlfriend sent me a text message yesterday informing me that my upcoming birthday in March (the 13th!) falls on a Friday this year. For whatever reason, I misinterpreted her text message as asking when my birthday will fall on a Friday in the future.

Which, of course, got my gears turning for writing a quick script that generated all the years in the near future that my birthday falls on Friday the 13th. Here’s a quick-and-dirty PHP version of what I came up with:

$numberOfYears = 100; // this is how many years ahead we want to look
$currentYear = date('Y');
for ($i = 0; $i < $numberOfYears; $i++) {
  $yearLoop = $currentYear + $i;
  $timestamp = $yearLoop . "-03-13"; // 2008-03-13, 2009-03-13 ...
  if (date('w', strtotime($timestamp)) == 5) { // this means it's a Friday
    echo $yearLoop . "\n";
  }
}

I ran this program and it gave me the following output:

2009
2015
2020
2026
2037

Huh, I thought. Only 5 birthdays fall on Friday the 13th in the next 100 years? So I increased $numberOfYears to 1000 and ran it again. Same five years popped up.

I stared at it for another few seconds, then it suddenly dawned on me, and I almost started laughing. Can anyone guess why? (hints are below if you need them)

Hint #1: I ran this program on OS X.

Hint #2: Google “2038”.

I got pwnd! πŸ™‚

Advertisements

About Shannon Quinn

Oh hai!
This entry was posted in Blogging, Programming, Real Life, The Lady and tagged , , , , , . Bookmark the permalink.

4 Responses to Pressin’ it, 2.7-style

  1. magsol says:

    I have no idea what you’re talking about.

  2. eksith says:

    OH!
    Dude, that’s cold 😦

  3. magsol says:

    Yeah…thanks for pointing that out. I’ve had my head down studying for finals for too long πŸ˜›

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s