anarchoi Posted February 2, 2008 Share Posted February 2, 2008 ok here is my situation: i have this code $query = "SELECT e.*, t.*, p.* FROM event AS e, thread AS t, post AS p WHERE t.forumid = 16 AND t.threadid = p.threadid AND p.parentid = 0 AND t.title LIKE '$yo' AND t.forumid = '16' AND e.eventid = t.lv_vb_eventforums_eventid ORDER BY e.dateline_from DESC LIMIT $affichage"; as you can see, my table "event" contains a row called "DATELINE_FROM". It contains a date for each entry that was added, but it is unix-encrypted and looks like 3472139847 instead of 01/01/2008. What I want to do, is limit my query to the entries where DATELINE_FROM is inferior of today's date.... this way it will display only the upcomming events, and not the old ones how can I do this? Quote Link to comment https://forums.phpfreaks.com/topic/89111-query-only-entries-where-field-date-after-today/ Share on other sites More sharing options...
Barand Posted February 2, 2008 Share Posted February 2, 2008 If it's held as unix time then 01/01/2008 should be 1199145600 Quote Link to comment https://forums.phpfreaks.com/topic/89111-query-only-entries-where-field-date-after-today/#findComment-456407 Share on other sites More sharing options...
anarchoi Posted February 3, 2008 Author Share Posted February 3, 2008 yeah it was just a random number any way i can limit my query to show only the entries where date is after today? Quote Link to comment https://forums.phpfreaks.com/topic/89111-query-only-entries-where-field-date-after-today/#findComment-456422 Share on other sites More sharing options...
AndyB Posted February 3, 2008 Share Posted February 3, 2008 ... WHERE your_date_field>today_in_the_same_time_format ... adjust to suit Quote Link to comment https://forums.phpfreaks.com/topic/89111-query-only-entries-where-field-date-after-today/#findComment-456535 Share on other sites More sharing options...
anarchoi Posted February 3, 2008 Author Share Posted February 3, 2008 but is there a function that can automatically parse today's date in the timestamp format .... so i don't have to edit my script everyday to change the date lol Quote Link to comment https://forums.phpfreaks.com/topic/89111-query-only-entries-where-field-date-after-today/#findComment-456545 Share on other sites More sharing options...
AndyB Posted February 3, 2008 Share Posted February 3, 2008 time() Quote Link to comment https://forums.phpfreaks.com/topic/89111-query-only-entries-where-field-date-after-today/#findComment-456558 Share on other sites More sharing options...
Barand Posted February 3, 2008 Share Posted February 3, 2008 or WHERE FROM_UNIXTIME(DATELINE_FROM) > NOW() Quote Link to comment https://forums.phpfreaks.com/topic/89111-query-only-entries-where-field-date-after-today/#findComment-456613 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.