in reply to simple stupid time question

One nit in your code...it should be
... if($month == 1) { ...
instead of 2 (since you decrement it to match the index)