What i want may seem simple but i have been at it for hours trying to get it to work and searching the internet for answers.

What i have been trying, and failing at doing, is taking X minuets from a time selected from a database (which is in the format DateTime in the database). Then after taking X minuets, use the new time to select something else from a database, base on the new time (Which is also in the format of DateTime in the datbase).

Any help would be much appreciated.

Recommended Answers

All 2 Replies

Following query will add 15 minutes to col2 and then compare new time with col1.
col1 and col2 must be datetime type column.

select * from mytable 
where col_1_datetime= date_add(col_2_datetime ,interval 15 minute)

Thanks for your reply. From that i found this function which works great:

WHERE Date>DATE_SUB('$UserLastCommentDate', INTERVAL 15 MINUTE)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.