Jump to content

[SOLVED] MySQL query searching for future date


bsamson

Recommended Posts

Alright I currently have this code:

 

<?php
mysql_query("SELECT * FROM v2callbacks WHERE DATE_FORMAT(FROM_UNIXTIME(`entrydate`), '%Y/%m/%d') = '2008/05/13'")
?>

 

How do I change this section:

DATE_FORMAT(FROM_UNIXTIME(`entrydate`), '%Y/%m/%d')

 

to add 15 days to the entrydate field? Not change the field BUT take the entrydate and add 15 days.

 

Thanks in advance!

hmmm ... when I run the following query ... it doesn't appear to error out. Any pros and/or cons?

 

<?php
mysql_query("SELECT * from v2callbacks WHERE DATE_ADD(DATE_FORMAT(FROM_UNIXTIME(`entrydate`), '%Y/%m/%d'), INTERVAL 15 DAY) = '2008/05/13'");
?>

 

Thanks again...

Thanks for the input. But it doesn't appear to be working. Via phpMyAdmin I am running this query:

 

SELECT * from v2callbacks WHERE DATE_ADD(DATE_FORMAT(FROM_UNIXTIME(`entrydate`), '%m/%d/%Y'), INTERVAL 15 DAY) = '05/28/2008'

 

I have a field that I set the entrydate to: 1211995559 (which is 05/28/2008)

 

However, phpMyAdmin reports:

MySQL returned an empty result set (i.e. zero rows). (Query took 0.0004 sec)

 

Any suggestions?

Thanks for the input. But it doesn't appear to be working. Via phpMyAdmin I am running this query:

 

SELECT * from v2callbacks WHERE DATE_ADD(DATE_FORMAT(FROM_UNIXTIME(`entrydate`), '%m/%d/%Y'), INTERVAL 15 DAY) = '05/28/2008'

 

I have a field that I set the entrydate to: 1211995559 (which is 05/28/2008)

 

However, phpMyAdmin reports:

MySQL returned an empty result set (i.e. zero rows). (Query took 0.0004 sec)

 

Any suggestions?

If you are adding 15 days, the entrydate would need to be 5/13/2008 to get a match on 5/28/2008

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.