WendyLady Posted June 12, 2006 Share Posted June 12, 2006 Hi -- I'm wondering about a clarification, because I can't find an answer.Basically, I'm trying to form a query that will look in the database, find all entries where the difference between a stored date & today is 0 (i.e., whether that date has passed). Another one, similarly, to find all entries where the difference between today & a stored date is <60.I'm playing around with the mysql DATEDIFF() function, but I can't even get it to tell me what the date difference was (not sure how to return it).And is it possible to have a query that says "SELECT * FROM xyz WHERE DATEDIFF('now()', 'stored_date')<60" ? It doesn't seem to be working, but I'm not sure if isn't just because I'm not doing it right.The mysql documentation isn't helping me all that much -- if there is another source, I would love to know about it.The point of my code will be to make changes to the entries where the stored date has passed, so would it be easiest to select all where stored_date < now()? I'm playing around with it in lieu of finding anything illuminating . . . Thanks --Wendy--If I ever figure out dates, I'll be SET! Quote Link to comment https://forums.phpfreaks.com/topic/11812-datediff-question/ Share on other sites More sharing options...
redarrow Posted June 13, 2006 Share Posted June 13, 2006 [code]<? $data1 = mktime (0,0,0,5,5,2005); //specify a date1$data2 = mktime (0,0,0,5,15,2005); //specify a date2$differenza = ($data2 - $data1 ) / 86400;echo " The Different $data2 - data1 = $differenza";?> [/code]mysql link for date diffrence ok.[a href=\"http://www.mysqlfreaks.com/statements/56.php\" target=\"_blank\"]http://www.mysqlfreaks.com/statements/56.php[/a] Quote Link to comment https://forums.phpfreaks.com/topic/11812-datediff-question/#findComment-44887 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.