Jump to content

php/mysql Date verification


pugs1501

Recommended Posts

I was wondering if any one could help me figure out how to setup and seck to see if a start and end date which would be stored in the mysql database have been met or not. If the start date has been met and the end date has not i want it to display the data in the table if the start date has not been met or the end date has been met then the data should disapear off the screen then.
Link to comment
Share on other sites

[!--quoteo(post=371467:date=May 5 2006, 03:08 AM:name=pugs1501)--][div class=\'quotetop\']QUOTE(pugs1501 @ May 5 2006, 03:08 AM) [snapback]371467[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I was wondering if any one could help me figure out how to setup and seck to see if a start and end date which would be stored in the mysql database have been met or not. If the start date has been met and the end date has not i want it to display the data in the table if the start date has not been met or the end date has been met then the data should disapear off the screen then.
[/quote]


If I understand your question the data will be displayed only if the $current_date is between your $start_date and $end_date?

The date in mysql database will have the format Year-Month-Day
First:
$current_date=date("Y-m-d");

Let's assume the columns for the start date and end date in your database table are: start_date and end_date. Your query will be something like:

$query="Select field1, field2,... from Tablename where startdate<='".$currentdate."' and enddate>='".$current_date."'";

You can then extract the results as you will.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.