Jump to content

Select from mysql using datediff


groovejuice

Recommended Posts

I am just beginning with php/mysql and am looking for help coding this. I need to filter and display certain values from a table if a datediff is more than 182 days.

 

select last name, first name, email from table WHERE DATEDIFF ( DATE1 (date from drop down selection) - DATE2 (date from proj_date column) > 182)

 

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/239680-select-from-mysql-using-datediff/
Share on other sites

@xyph thank you very much for your reply! I will test this code tomorrow. I do not have spaces in the column names, I just tried to illustrate the logic and did not worry about syntax since I'm working from a manual for each bit of code. I appreciate your assistance very much.

When he writes an example like this

 

DATE1 (date from drop down selection) - DATE2 (date from proj_date column) > 182

 

It seems like he won't care about negative vales, he only cares if the user input is more than 182 days after, not before.

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.