Jump to content

Help! Is it possible to check a date against the past?


djandy14

Recommended Posts

Heyy,

 

I've created an online booking system for my disco website, but am finding a number of clients misclick the year and end up booking a disco for August 2008 instead of August 2009, for example which causes all sorts of problems. I need to keep the current year for future bookings but was hoping i could add a script to my page that will check the entered date against the current date, if the entered date is in the past it will return with a false request denying the client and returning them to the initial page.

 

Is this possible? And if so, could anyone help me out!!! =]

 

Thank you!!

 

Andy  ;D

depends on how you are storing the date in the database but basically you would want to do something like this(of course this is using a timestamp):

 

<?php
$todays_date = time(); \\time it is now
$customer_picked_date = time()-1; \\just did that so you know it is less than the actual time

//you can do an if statement and if it returns false show an error message
if($todays_date > $customer_picked_date)
{
echo "That date has already passed";
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.