kmaid Posted January 21, 2009 Share Posted January 21, 2009 Hi all, My current PHP project requires me to cache data for 5 minuets after which IF the data is requested again the data needs to be requested from another server. I store the DateTime when the data was last requested and what I would like to do is make an SQL query which returns true/false depending on if 5 minuets have passed since the stored DateTime. Is this possible and are there any examples of this or should I just convert the DateTime into a php date time and do it in PHP? Thanks Kmaid **EDIT** My bad didnt read sticky mysql version 5.0.51b-community-nt Link to comment https://forums.phpfreaks.com/topic/141803-solved-returning-boolean-from-datetime-field/ Share on other sites More sharing options...
Mchl Posted January 21, 2009 Share Posted January 21, 2009 SELECT IF(NOW() - dateTimeRequested < 300, TRUE, FALSE) FROM table edit it seems that even SELECT NOW() - dateTimeRequested < 300 FROM table will work (and of course 5 minutes is 300 seconds not 600 ) Link to comment https://forums.phpfreaks.com/topic/141803-solved-returning-boolean-from-datetime-field/#findComment-742385 Share on other sites More sharing options...
kmaid Posted January 21, 2009 Author Share Posted January 21, 2009 Thanks exactly what i was looking for! Link to comment https://forums.phpfreaks.com/topic/141803-solved-returning-boolean-from-datetime-field/#findComment-742394 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.