Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Derick Rethans' Blog:
Calculating start and end dates of a week
Nov 16, 2006 @ 15:13:37

Derick Rethans has posted a quick tip to his blog today:

A friend asked "How do I calculate start (monday) and end (sunday) dates from a given week number for a specified year?" Instead of having to come up with your own algorithm you can simply do the following in PHP 5.1 and higher.

The (technically) three-line code uses ISO format for the date to tell you which day is the starting day of that week and which is the end. He only explains this format just a bit, so if you want more information, check out the strtotime function page.

tagged: start day end week date strtotime iso format start day end week date strtotime iso format