Calculate Age
This is my first blog on programming.
Today I am going to talk about calculating age. I was suppose to implement a User Profile page, and I need to display the age. I found some code on http://snippets.dzone.com/posts/show/1310. calamus77 came out with a very interesting method. He compared month and date together. I copied his idea the wrote the following function. By using a simple string comparison, I can reduce the number of (nested) if..else.
Try passing strtotime(’1985-07-15′) into the function and you will find out my age
Posted in Tao Of Programming at February 2nd, 2009. No Comments.