To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm > -----Original Message----- > From: Shaun [mailto:shaunthornburgh@xxxxxxxxxxx] > Sent: 20 October 2004 11:35 > > I am trying to use the strtotime function to get dates for > the first and > last days of a given week: > > <?php > echo date("Y-m-d", strtotime("last monday", > strtotime("2004-10-18"))).'<br>'; > echo date("Y-m-d", strtotime("sunday", strtotime("2004-10-18"))); ?> > > Using the code above works fine until the date input is a > Monday then it > outputs the date of the previous Monday. Does anyone know of > another way? I believe my solution to this went something along the lines of strtotime("-6 days monday", ....); It's quite a while since I last used this, so I might not have it quite right, but this should set you on the road. Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: m.ford@xxxxxxxxxxxxxx Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php