Jump to content

Dates, finding from 2 weeks ago to 1 month ago..


0o0o0

Recommended Posts

What does one use to make this from 2 weeks to 1 month ago?

This is now till a month ago ( in days)

 

 WHERE date > DATE_SUB(NOW(), INTERVAL 1 MONTH)

 

How do you change NOW() to 14 days ago, INTERVAL 1 MONTH

 

 WHERE date > DATE_SUB(NOW(), INTERVAL 1 MONTH)

 tried...

- 14

14 DAY

14 DAYS

- 14 )

NOW(-14)

NOW() - 14

 

Nothing on the net i found in roughly 60 searches matched anything ive tried to do.

 

So... basically  find everything in the db from 14 days ago.. to 1 month ago.

 

on going rolling day to day.. I mean everyday no solid dates used the query..

 

so in 14 days from now (MAR 4) it would show Feb 19 (todays entires) to jan 19th

 

Thanks.

 

Link to comment
Share on other sites

*Edit: Nevermind, I didnt understand you wanted a range.

 

This is a correct query. Run it by itself. You will have to figure out what is up with your data assuming you have a correct date column and format.

 

 

 

SELECT DATE_SUB(NOW(), INTERVAL 14 DAY)

Edited by benanamen
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.