Sharon Ann Posted April 26, 2006 Share Posted April 26, 2006 HiI have a table called "fault". In this table I have fields called date_opened and date_closed. I would like to select all records from "fault" whereby the time period between date_opened and date_closed is over 2 days. This is the pseudo code that I think I sort of need, but I'm not sure the correct way to write it in a php page.Select * from fault where (date_closed - date_opened) >2; Can anyone help? Quote Link to comment https://forums.phpfreaks.com/topic/8487-calculating-with-date-fields/ Share on other sites More sharing options...
Sharon Ann Posted April 26, 2006 Author Share Posted April 26, 2006 I've just found this bit of SQL and am wondering whether this is what I need,select * from fault where Datediff('date_closed','date_opened')>2;Is this the SQL or is there another way? Quote Link to comment https://forums.phpfreaks.com/topic/8487-calculating-with-date-fields/#findComment-31054 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.