How would I go about getting the date of say the 32 Wed of a given year. Is there an easy way to do this that I am missing?
+1
A:
It is worth noting, that strtotime() accepts ISO week date format (for example "2008-W27-2" is Tuesday of week 27 in 2008), so it can be easily used to get the date of a given week number.
Sjoerd
2010-08-25 18:01:02
`var_dump(strtotime("2008-W27-2"));` returns `false` for me on PHP 5.1.6, but works on 5.2.10. `var_dump(strtotime("2008W272"));` (ie. without the dashes) works in both.
Daniel Vandersluis
2010-08-25 18:02:52
I did not know the ISO week date format. That does it, should have asked here 2 hours ago. Thanks a lot
arkansasonline
2010-08-25 18:05:58
+1
A:
echo date("d m Y", strtotime("2010-W32-3"));
i think... :p
Edit: W32 is the week number and 3 is the day of the week (1-7)
Or maybe something more complicated like this - its a bit pointless if the above works - but was just thinking of alternatives... I don't know if it would work. :p Just for fun.
echo date("d m Y", strtotime("1-1-2010 + 32 Weeks ".date("N", "Wednesday")." Days"));
maybe, but now I'm clutching at straws ha. :)
Thomas Clayson
2010-08-25 18:02:36
So to make it any year it would be as easy as `$year = '2010';` and then `strtotime($year."-W32-3")`
bradenkeith
2010-08-25 18:05:58