开发者

Get Day of week for week number in php

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?


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.

Source


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. :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜