Jump to content

More than a month old ...


xProteuSx

Recommended Posts

I am extremely unfamiliar with date comparisons in MYSQL.  I've googled it, and I cannot find anything (though I am sure there must be something out there) that works for my particular situation.  Here it is:

 

I have a 'timestamp' field in my database.

 

The format of the field is like this:      2014-02-17 05:39:32

 

Now, I am trying to find all entries that are less than a month old.  Here is what I have been able to find, but have not been able to make work:

 

SELECT * FROM my_table WHERE tbl_time < date_sub(now(), interval 1 month);

 

It does not seem to matter where I have either of these:

 

SELECT * FROM my_table WHERE tbl_time < date_sub(now(), interval 1 month);

SELECT * FROM my_table WHERE tbl_time > date_sub(now(), interval 1 month);

 

Both of these queries return the same results.  How can this be?

Link to comment
https://forums.phpfreaks.com/topic/286260-more-than-a-month-old/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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