Date and Time Functions in MYSQL with example

What are the date and time functions in MYSQL? How to handle with date and time format in MYSQL.

Date and Time Functions in MYSQL

MySql E DATEDIFF It calculates the difference between two given dates or DateTime values
MySql DATE_FORMAT This command is used to format the date value, based on the format of system
MySql STR_TO_DATE It converts the string into date-time value in the specified format
MySql NOW It will return the date and time, on which the statement is executed

DATE_FORMAT in MYSQL

Syntax:

SELECT COUNT (aggregate_expression)

FROM table_name

[WHERE conditions];

EXAMPLE:

SELECT COUNT(*) FROM employee_tbl

WHERE name="Zara";

NOW in MYSQL

Syntax:

SELECT COUNT (aggregate_expression)

FROM table_name

[WHERE conditions];

EXAMPLE:

SELECT COUNT(*) FROM employee_tbl

WHERE name="Zara";