Solved

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

Posted on 2007-11-26
2
197 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
Comment Utility
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
Comment Utility
Awesome thank you very much.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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…

743 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