How to mark something by date and keep it marked if date has pasted?

Posted on 2007-11-26
Medium Priority
Last Modified: 2012-05-05
I have this code to display a msg if the date is set.  But I need to have the script say completed even though the day has past.  Have it set up for reports so people can see if it is completed or not.  But It works if it is the current day but I need it to say completed after that date has pasted also.  But say Not Completed if the day has not pasted.  

if ($d=="2007/11/18")
  $msg = "<font color='green'>Completed</font>";
  $msg = "<font color='red'>Not Completed</font>";

Open in new window

Question by:eiseng
LVL 20

Accepted Solution

steelseth12 earned 2000 total points
ID: 20352523
If i understand correctly this is what you want.
$d= "2007/11/18";
$time =  strtotime($d);
$now = time();
if ($time <= $now) {
  $msg = "<font color='green'>Completed</font>";
  $msg = "<font color='red'>Not Completed</font>";
print $msg;

Open in new window


Author Comment

ID: 20352545
Awesome thank you very much.

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question