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? 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 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? 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 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 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() 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() 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
Archived
This topic is now archived and is closed to further replies.