View Full Version : Finding a floating date with PHP
01-01-2006, 12:09 AM
I'm trying to find a floating date (for lack of a better word) like Thanksgiving with PHP. However, turns out that strtotime doesn't like the idea of turning "third Thursday in November" in a UNIX timestamp.
Is there any way to retrieve a floating date like this?
ralph l mayo
01-01-2006, 01:53 AM
strtotime seems to actually like something similar to what you tried, surprisingly enough. Try something like:
echo date('F j, Y', strtotime('November 1 next Thursday +2 weeks'));
I had no idea it was so robust.
e: maybe you want Oct 31 next Thursday instead, I don't know, it's confusing me :/
01-01-2006, 07:07 AM
Hmmm...I tried typing in Thanksgiving to see if that'd work, but that didn't. The October one works, kind of. The day is off by three.
This is kind of annoying. I can find a formula for Easter, but Thanksgiving/Mother's Day/Father's Day? Out of the question.
01-01-2006, 09:20 AM
This page is chock full of such dates.
01-01-2006, 08:28 PM
Hmmm, why didn't I see that before. Thanks, it helps alot. o.o
Edit: The comment about the dates, not the page for strtotime.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.