Question : Thursday's date in the present week

Hello experts!

I have this code:

$query_tablebookings_thurs = "SELECT id FROM reservations WHERE booking_date = '".date("Y-m-d", strtotime("Thursday"))."'";

But it gives me the date of the next thursday. I would like to get the date of Thursday in the present week. I hope someone can help me :-)

Thanks in advance!

Answer : Thursday's date in the present week

then check which day is it today

N = 1 (for Monday) through 7 (for Sunday)

$thurs  = "Thursday";
iToday = date(N);
if( in_array( iToday , array(5,6,7)  ) $thurs  = "last Thursday";

$query_tablebookings_thurs = "SELECT id FROM reservations WHERE booking_date = '".date("Y-m-d", strtotime("thurs"))."'";

:)
Random Solutions  
 
programming4us programming4us