CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Sort by date problems

Print topic Send  topic

Author Message
ckroon

Posts: 869
Posted: 09/16/2006, 10:38 AM

PHP/Mysql

I have an application that lists educational reports and each record has an expiry date.
I want a grid that will list all reports that are set to expire within six months.

I tried this:

WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) < exp_date;

but that doesn't do what I want.

Any suggestions?

_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
peterr


Posts: 5971
Posted: 09/16/2006, 11:41 AM

You would need to add 6 months to the current date, and check if it is not larger then the expiration date:
WHERE exp_date <= DATE_ADD(CURDATE(),INTERVAL 6 MONTH);

(not tested, just based on http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html)
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.