Is it possible for the code to show last Friday if the results fall on a weekend?

Is there anyway of getting the code to work as it should, BUT, if the resultant date falls on a weekend, it shows the previous Friday??

<?php
echo date('jS \\of F Y', strtotime('-2 weekdays')); 
?>

Any help appreciated.

Dez

Assuming your definition of weekend is Saturday and Sunday, your code will not let the resultant date fall on a weekend.

Can’t show the website, but at the moment, it’s showing 13th of March 2011 ? ?

Let me guess, you’re using PHP 5.2, something less than 5.2.7?

Php 5.2.5

Bingo! So, here is some good and/or bad news. The good news is that your code will work fine in, and after, PHP 5.2.7. The bad news is that it won’t in your current version.

Would you prefer to upgrade to somewhere where it will work, or work around the issue?

Thanks for that - I’m not adverse to bad news, but do prefer the good news! How do I do a work around please?

You’ll have to make your code slightly longer. Take a look at two days ago and see if it falls on a weekend; if so, move back to the previous Friday, otherwise do nothing.

Is that possible? How on earth would you do that?