how to check if the date is saturday.
<input id="datePicker" name="datePicker" type="text" class="textinput date-pick">
my code:
if(date('Y-m-d', strtotime('this Saturday')) == $_SESSION['search_date']) {
echo 'Event this saturday';
} else {
echo 'Event on the others day';
}
above code echoing only for the next week event! if i search for week after or 3 week etc, is not showing the result?
take a look at date() in the php-documentation. you chould change your code to something like this:
if(date('w', strtotime($_SESSION['search_date'])) == 6) {
echo 'Event is on a saturday';
} else {
echo 'Event on the others day';
}
This should do it:
if(date("w",$timestamp)==6)
echo "Saturday";
Check: http://nl2.php.net/manual/en/function.date.php
date('w', strtotime($_SESSION['search_date']))
should give the weekday. Check if it's 6, wich is saturday.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With