I want to request blog entries from a database created in the last 3 hours,
Table
blogs{id,blog_text,date}
date format: datetime
datetime
Try the following:
SELECT * FROM blogs WHERE date > DATE_ADD(NOW(), INTERVAL -3 HOUR)
Edit: my bad - replaced CURDATE()by NOW(), since we are dealing with DateTimes.
CURDATE()
NOW()
DateTime
Although @mways answer is completely correct, it is more readable and less error prone than just using DATE_SUB, as shown below:
DATE_SUB
select DATE_SUB(NOW(), INTERVAL 3 HOUR);
Source: https://habr.com/ru/post/1772036/More articles:Coldfusion - XML Pretty Print - coldfusionEF4 Object State Manager claims multiple records are attached when not - c #In any case, to quickly break a word into an array of characters in the c lens? - cEscape / Ignore special characters in HAML attributes - javascriptHow to convert NSString to char - charhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1772037/how-could-i-escape-a-in-haml-so-that-it-compiles-to-instead-of-amp-haml-noob&usg=ALkJrhiPOCHm0Hsum9yYxt4PU7d4i22xDQMimic `rollup` function in the general list - c #Django: Error: Incorrectly configured module does not define class "" - djangoRails - creating @projects avaialble on all page loads - ruby-on-railsИнструмент для поиска всех экземпляров класса - c++All Articles