How to Add a Running Total of Years and Days You’ve Blogged

Blogging for over 4 years. That’s me. I added a running total to the bottom of the blog.

I noticed Ben had the number of days he’d been blogging on the bottom of his blog and asked how he did it. He had a single line of php that he got from Jonathan Snook:

< ?= round( (time() - strtotime('November 1 2005')) / 60 / 60 / 24);?>

That worked, but it was way too many days for me so I added a little more php.

Here’s what I put in the footer of my pages: (The date is the date of my first post)

Blogging for < ? $days = round( (time() - strtotime('October 28th, 2002')) / 60 / 60 / 24 ); $years = round($days/ 356); $daysLeft = $days - ($years * 365); print "$years years and $daysLeft days"; ?>

Four years and 36 days. Crazy. And this post 1406 according my WordPress dashboard.


  1. Linoge says:

    So copy-pasting that into my blog gets me… well… that – the code, but no output. What am I doing wrong?

  2. Ron says:

    You have to put it in a template, not just a blog entry. And this is for WordPress, which is PHP based. If you were using Moveable Type it probably wouldn’t work because MT is perl based.

  3. Linoge says:

    Oh. Now I feel stupid.

  4. Ron says:

    No need to feel stupid. I should have mentioned the system requirements 🙂

Comments are closed.