honkmaster Posted May 18, 2012 Share Posted May 18, 2012 Hi I have a column in my database which is called "lastupdated" it stores a unix date and time stamp '1331299541' Fri, 09 Mar 2012 13:25:41 GMT. I want to run a query to retrieve any activity that happens that day i.e the day we are currently in. $query = "SELECT * FROM contacts WHERE lastupdated = '1331299541'"; As you can see i'm quite new to this so looking to be pointed in the right direction. I know its to do with formatting the date stamp? Cheers Chris Quote Link to comment Share on other sites More sharing options...
Barand Posted May 18, 2012 Share Posted May 18, 2012 ... WHERE DATE(FROM_UNIXTIME(lastupdated)) = CURDATE() Quote Link to comment Share on other sites More sharing options...
requinix Posted May 18, 2012 Share Posted May 18, 2012 I myself am a fan of doing as much work in PHP as is reasonable, so $start = mktime(0, 0, 0); $end = mktime(23, 59, 59); $query = "SELECT * FROM contacts WHERE lastupdated BETWEEN $start AND $end"; Quote Link to comment 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.