in reply to How Many Days in the Past?

Lemme confirm what suaveant is saying: the month field (5th arg to timelocal) goes from 0 to 11. This is, I note, to maintain parity with what gmtime and localtime return.

So what you're seeing is that APRIL (not March) 29th is later than April 23rd. You have to subtract one from the $month you pass to timelocal (and, correspondingly, add 1 to the month you get back from localtime when it matters; here it doesn't, but ...)

Writing at 988046639 ... =)