PDA

View Full Version : If date is a weekend??


J_mo
01-17-2011, 03:48 PM
Hi,

How can I identify if a date (d/m/y format) is as weekend?

So...

$date = date(d/m/y);

if ($date == a weekend){

//do stuff

};

Thanks
Phil

edbr
01-18-2011, 01:23 AM
<?php
$today = date("D" );

if ($today == 'Sat' ) {echo "it is the weekend today";}
?>

J_mo
01-18-2011, 08:55 AM
Thanks for that...

I am unsure this will work for me though, perhaps I should have explained:

$date is actually equals to an input that will be in d/m/y format, I think that changes things doesn't it?

$today = trim($_POST['date']);]

Thanks
Phil

edbr
01-18-2011, 10:14 AM
d will return the day number in the month so yes it will