How to get date from week number & day number and year?

Viewed 18022

I'm trying to get the date from the week number, day number and year.

For eg:

week number = 52   
day number = 4 (of week 52)  
year = 2013  

In this case, the date should be 26-12-2013.

How can I do it using PHP? I've already tried with strtotime(), but I'm confused about the formats. Can someone help?

3 Answers

You can also use the strtotime function. In your example, you can write:

date("Y-m-d", strtotime("Y2013W52-4")) // outputs: 2013-12-26

The strtotime will give you a timestamp that you can use in combination withe the date function.

Related