Suggestions welcome!!!!
$diff - gives me the numerical value of the difference in days.
$date1 - just the numerical day of today.
$date2 - just the numerical value of the stored ECD.
PROBLEM: If the dates go like this:
$date1 is Januarary 1
$date2 is February 22
this program doesent work cause its simply subtracting two numbers, its not going by months, or how many days are in the month for that matter.
Here is the snippet out of my program:
Code: Select all
<?php
$date1 = strftime("%d");
list($month, $day) = explode("-", $row["ecd"]);
$date2 = $day;
if($date1 > $date2) {
$diff = $date1 - $date2;
} elseif ($date2 > $date1) {
$diff = $date2 - $date1;
} else {
$diff = "0";
}
if($diff >= "7" || $diff <= "0" || $row["note"] == "false") {
if($row["assigned"] == "false") {
$currenttime = time();
$futurdate = strtotime("+10 days", $currenttime);
echo date("m-d", $futurdate);
} elseif($row["assigned"] == "true" && $row["sent_to_reviewer"] == "false") {
$currenttime = time();
$futurdate = strtotime("+7 days", $currenttime);
echo date("m-d", $futurdate);
} elseif($row["sent_to_reviewer"] == "true") {
$currenttime = time();
$futurdate = strtotime("+2 days", $currenttime);
echo date("m-d", $futurdate);
}
} else {
list($month, $day) = explode("-", $row["ecd"]);
$new_date = $month . "-" . $day;
echo $new_date;
}
?>