Solved

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

Posted on 2007-11-26
2
210 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Append letter to end of string 4 36
nagios 4 php error after installation 6 78
datetime in sql 6 29
Why my select dropdown does not work? 8 27
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

895 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now