Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP Date validation. 1

Status
Not open for further replies.

netbuster91

Technical User
Nov 17, 2004
17
GB
Hello everyone,
I'm a fairly novice programmer and I’ve been doing some PHP pages. I'm struggling to find code that suits my purpose that I can understand, most of it seems far to convoluted for what I need.

I'm using a JavaScript calendar which auto fills a textbox in the format yyyy-mm-dd.
All i wish to do is to take this date and ensure it is not in the past.

If anyone could offer me some advice or code snippets I would be very grateful!
 
Code:
$date = "yyyy-mm-dd";
if (time() > strtotime($date)){
 echo "date in the past";
}
 
That seems like a very sensible solution, thank you very much!
I will test it tomorrow and post the results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top