Calculating the day number in PHP

We’ve packed several dynamic areas into our footer. You may have noticed some of them or perhaps none, I mean who actually looks at a website footer?

COFFEE CONSUMED

We love coffee, it helps get motivated and ready for the chaos that is our normal day (by the way, did I mention we have three young children)…

Our footer uses a script to calculate the total number of days since January the 1st and then multiples it by 2 as we are creatures of habit here and on average drink two cups of coffee a day.

The PHP code we use to work all this out uses the normal PHP function date(“z”) + 1 then multiples it by 2

$dayNumber = (date("z") + 1)*2;

Then we write it out to the screen:

echo $dayNumber.'<br />';

Simples

1 reply

Leave a Reply

Your email address will not be published. Required fields are marked *