LuckyBajpai Posted September 10, 2014 Share Posted September 10, 2014 I have database "raj" with table "pagination" In table pagination have "id", "actualtime" and "created" field id - auto_increment actualtime- varchar created- datetime that looks like this CREATE TABLE pagination( id int auto_increment, actualtime varchar(55), created datetime ) I want to display all rows which are created on todays date and will display from today upto yesterday at 06:00 pm. after that the content will be refreshed based on based on a DATETIME field called 'created' that holds the date and time of each record's creation. this is my query to fetch rows but it display value after 06:00 pm on yesterday but i want to display all data before 06:00 pm from currentdate. After 06:00 pm data will be refreshed and clear. plz help me...... SELECT actualtime FROM pagination WHERE created BETWEEN date_add(date_sub(curdate(), INTERVAL 1 day), INTERVAL 18 hour) AND curdate()"; Link to comment https://forums.phpfreaks.com/topic/290975-select-value-between-particular-date-and-time-schedule/ Share on other sites More sharing options...
Barand Posted September 11, 2014 Share Posted September 11, 2014 Is this what you mean? WHERE created BETWEEN CONCAT(CURDATE() - INTERVAL 1 DAY,' 18:00:00') AND CONCAT(CURDATE(),' 18:00:00') Link to comment https://forums.phpfreaks.com/topic/290975-select-value-between-particular-date-and-time-schedule/#findComment-1490721 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.