![]() |
mySQL Date Manipulation of joindate and Today's Date
I just want to create an SQL statement that will produce a list of users whose joindate is greater than or equal to Today's Date. And while I know a little bit about UNIX, mySQL is null. Can anyone tell me what I am am doing wrong, or is it all wrong? Seems like these would be really easy but I can't seem to add the 120 days to joindate correctly:
SELECT username, joindate FROM user WHERE DATE_ADD(joindate, 120) >= UTC_TIMESTAMP(); I have to assume that DATE_ADD isn't valid for adding 120 days to a date or UTC_TIMESTAMP isn't today's date. Or both? |
Since it's just an integer column, you can use some simple math to do it:
Code:
WHERE joindate >= unix_timestamp(now()) - (86400 * 120); |
That was awesomely fast and totally correct. You can close this thread! This might be a some kind of world record!
Thanks! |
All times are GMT. The time now is 03:26 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|