Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-12-2012, 12:35 PM   PM User | #1
jake66
New Coder

 
Join Date: Jul 2011
Posts: 23
Thanks: 8
Thanked 0 Times in 0 Posts
jake66 is an unknown quantity at this point
date question

Hi,

I would like to know if it is possible and how to set (in a query) a function to retrieve all the records where date is anywhere from today up to one month ahead.
I can do queries I am just interested in this function.

Thanks in advance,
Jake

(maybe this should be in MySQL - I am not sure - sorry if it should :P )
jake66 is offline   Reply With Quote
Old 02-12-2012, 12:39 PM   PM User | #2
KuriosJon
Regular Coder

 
Join Date: Jan 2012
Posts: 134
Thanks: 0
Thanked 32 Times in 32 Posts
KuriosJon is on a distinguished road
Code:
select * from table where your_date_column < date_add(your_date_column, interval 1 month)
mysql date_add()
__________________
Roundabout Time Tracking
KuriosJon is offline   Reply With Quote
Users who have thanked KuriosJon for this post:
jake66 (02-13-2012)
Old 02-13-2012, 12:58 PM   PM User | #3
jake66
New Coder

 
Join Date: Jul 2011
Posts: 23
Thanks: 8
Thanked 0 Times in 0 Posts
jake66 is an unknown quantity at this point
thanks
jake66 is offline   Reply With Quote
Old 02-13-2012, 02:17 PM   PM User | #4
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,662
Thanks: 4
Thanked 2,452 Times in 2,421 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
You may want to use a BETWEEN to pull the CURDATE() as well. The above code will pull all records up to a month from today, but also from anything in the past.
Moving to MySQL forum.
Fou-Lu is offline   Reply With Quote
Reply

Bookmarks

Tags
date, php, query

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:29 PM.


Advertisement
Log in to turn off these ads.