odd February 2016

check if its the next week or more from the latest update

I am banging my head a little with strtotime and trying to figure out how to get what i need to achieve.

ill write it in the logic i need not the php i need.

$today = today
$lastUpdated = query from DB

if today is >= $lastUpdated(next week)
do something

else do something else

basically someone is only allowed to submit a form once a week, not once every 7 days like i have it now. i think i need to use strtotime somehow to achive what i need but im a little lost

odd

Answers


odd February 2016

appear to have got it working as intended:

 $userDate = "2016-02-06";
$userUpdate = date('Y-m-d', strtotime($userDate. ' next week'));
$today = date('Y-m-d');


echo "userUpdate: " . $userUpdate . "///////////";
echo "today: " . $today . "///////////";


if ($today >= $userUpdate):
  echo "BIGGER";
else:
  echo "SMALLER";
endif;

Post Status

Asked in February 2016
Viewed 3,777 times
Voted 12
Answered 1 times

Search




Leave an answer