MySQL Datediff (Date Difference Calculation)

MySQL

To calculate numbers of days between two colums, MySQL has Datediff function for calculation between two dates.

Example Usage:

SELECT DATEDIFF (NOW (), date) as ExampleDate FROM Calendar;


This query will check Today's Date by Now() function of MySQL and calculate days from "Example" date until today.

Datediff Usage is not well-known by communities and many people are doing these calculations with additional requirements. 

Using this query can save "PHP" side codings by solving them on "Query Stage" without requiring to be proceed from raw.

Comments/Questions

You must complete Security Verification to submit your form.