Im trying to calculate number of days left to next monday and it returns 10, Im sure its wrong, days left to next monday is 5, what im doing wrong?
if (isset($_POST['entry'])) {
$email=mysql_real_escape_string($_POST['email']);
$t_shirt=mysql_real_escape_string($_POST['t-shirt']);
$today = date("m.d.Y");
$next_monday = date("d, m, Y", strtotime('next monday'));
$last_monday = date("d, m, Y", strtotime('last monday'));
$today = date("d.m.Y");
$select_current=mysql_query("SELECT * FROM entry_form WHERE email='$email'");
if (mysql_num_rows($select_current) >= 1) {
while ($row=mysql_fetch_array($select_current)) {
$last_registered=$row['registered'];
}
$diff = abs(strtotime($last_registered) - strtotime($last_monday));
$years = floor($diff / (365*60*60*24));
$months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
$days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
echo "$days";
}