THIS BLOG HAS MOVED TO http://brian.moonspot.net/
Man, what did I do before strtotime(). Oh, I know, I had a 482 line function to parse date formats and return timestamps. And I still could not do really cool stuff. Like tonight I needed to figure out when Thanksgiving was in the US. I knew it was the 4th Thursday in November. So, I started with some math stuff and checking what day of the week Nov. 1 would fall on. All that was making my head hurt. So, I just tried this for fun.
strtotime("thursday, november ".date("Y")." + 3 weeks")
That gives me Thanksgiving. Awesome. It is cool for other stuff too. At its very basic, it can take a MySQL datetime field and turn it into a timestamp. Very handy for date calculations. It also understands RFC 2822 and ISO 8601 date formats. These are common in HTTP headers and some XML documents like RSS and Atom feeds. Also, PHP can output those two standard formats with the date() function. So, this makes them a good standards compliant way to pass full, timezone specific dates around.