Date Functions

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
Etherguy
Forum Commoner
Posts: 70
Joined: Fri Nov 01, 2002 9:09 pm
Location: Long Island, New York

Date Functions

Post by Etherguy »

Morning Happy Campers,

I am trying to see if a date in my date column will happen within the next 30.60.90 days.

When I use.

Code: Select all

select * from domains where expire <= (now() + 30)
I seem to get results of dates that are not set ( ie... 0000-00-00) but no matter what I set the + number to I always get the same results.

Any one have an idea of how to get the results of days that will expire in the future??

Regards
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

Code: Select all

select * from domains where expire <= (now() + interval 30 day)
User avatar
liljester
Forum Contributor
Posts: 400
Joined: Tue May 20, 2003 4:49 pm

Post by liljester »

http://www.mysql.com/doc/en/Date_and_ti ... tions.html

i think they actually have an example of what you want to do near the top =)
User avatar
Etherguy
Forum Commoner
Posts: 70
Joined: Fri Nov 01, 2002 9:09 pm
Location: Long Island, New York

Post by Etherguy »

Figures.... I always seem to be a word or two off....


Thanks for the quick reponse!!

Regards.
Post Reply