Hello world and Happy Programmer’s Day!

Hello World

It is a tradition that whenever you start learning a new (programming) language, you start with a Hello World example. Today, I am finally starting this blog and it is fit to say Hello World!

Additionally, I would say that today is also the programmer’s day. I know the programmer’s day is 13th of September of a regular year (and 12th Sep of a leap year) as it is the 256th day of the year.

I beg to differ (slightly).

I would say Sep 14th of a regular year (and 13th Sep of a leap year) is the 256th day. How? Simple! We are talking about programmers; and programmers (almost) always begin counting with 0 (since 0x00). We count Jan 1st as 0th day, not first. According to that calculation, Sep 14th is the 256th day of a regular year.

If you want to verify, use this simple PHP snippet:

echo date('z', mktime(0, 0, 0, 1, 1, 2011)) . "\n"; // Verify Jan 1st is 0th day
echo date('z', mktime(0, 0, 0, 9, 14, 2011)) . "\n"; // Now check for Sep 14th

You can see from PHP documentation on date function that format character ‘z’ will return “The day of the year (starting from 0)”. If you don’t have PHP, check it in your own language. In fact, real programmers do this math on hand. (I did!)

That is all for today. I wanted to launch this blog on this day as soon as I realized that this is actually the real programmer’s day. More coming soon…