Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: date question

  1. #1
    New Coder
    Join Date
    Jul 2011
    Posts
    23
    Thanks
    8
    Thanked 0 Times in 0 Posts

    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 )

  • #2
    Regular Coder
    Join Date
    Jan 2012
    Posts
    134
    Thanks
    0
    Thanked 32 Times in 32 Posts
    Code:
    select * from table where your_date_column < date_add(your_date_column, interval 1 month)
    mysql date_add()

  • Users who have thanked KuriosJon for this post:

    jake66 (02-13-2012)

  • #3
    New Coder
    Join Date
    Jul 2011
    Posts
    23
    Thanks
    8
    Thanked 0 Times in 0 Posts
    thanks

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    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.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •