How to calculate date interval between two dates in MySql?

How to calculate date intervals between two dates in MySql? For example, send notification before two weeks of medicine expiry etc.

I'm going to share how to calculate the date intervals between two dates like calculating 1 month before, two weeks before etc. You can do this using "DATE_SUB" mysql function. Find the below example to get proper understanding, it is an example of getting all medicines which are going to expire in next two weeks:

$sql = "SELECT * FROM `products` p WHERE CURRENT_TIMESTAMP >=  DATE_SUB(FROM_UNIXTIME(p.medicine_expiry_date, '%Y-%m-%d 00:00:00'), INTERVAL 2 WEEK)";

Use this function wherever such requirement comes and it will solve easily.