1. Date()

$sql = “SELECT DATE(from_date) FROM salaries”;

Description

The DATE() function extracts the date part of a date.

Output

Output of the above example will be:
DATE(from_date)
2016-10-03
2016-10-03
2016-11-02

2. DATE_ADD()

$sql = “SELECT  DATE_ADD(FROM_date,INTERVAL 30 DAY) FROM salaries”;

Description

The DATE_ADD() function adds a specified time interval to a date.

Output

Output of the above example will be:
DATE_ADD(FROM_date,INTERVAL 30 DAY)
2016-11-02
2016-11-02
2016-12-02

Advertisements