Solved

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

Posted on 2007-11-26
2
225 Views
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.  

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

Open in new window

0
Comment
Question by:eiseng
2 Comments
 
LVL 20

Accepted Solution

by:
steelseth12 earned 500 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>";
 
}else{
 
  $msg = "<font color='red'>Not Completed</font>";
 
}  
 
print $msg;

Open in new window

0
 

Author Comment

by:eiseng
ID: 20352545
Awesome thank you very much.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
This article discusses how to create an extensible mechanism for linked drop downs.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
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 …

821 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