In my database I have one table in which I keep registered users. One column is Date of register and I keep this value in my own string format. For example "[2013-11-30] [19:42:46]"
Then I want to make a check. If user is 30 days old or more. The sure thing is that the above code is wrong. The problem is that if one user registers at 29/01/2015 will not been showing in 30 last days if the current day is 02/02/2015!
//Datetime
$today = date_parse_from_format("[Y-m-d] [H:i:s]", gmdate("[Y-m-d] [H:i:s]"));
$store = date_parse_from_format("[Y-m-d] [H:i:s]", $row["LastSeen"]);
if (
(($store[year] >= $today[year]) && ($store[month] >= $today[month]))
)
{ $date_last = "<font color='green'>".$row["LastSeen"]."</font>"; }
else
{ $date_last = "<font color='red'>".$row["LastSeen"]."</font>"; }