Date Functions

Date Functions

DATE

The date functions are used to insert dates into the database. It can also be used to extract date value from date expressions.

TIME

The time function is used to insert time expressions into database.

DATE AND TIME

This function is used to insert both date and time expressions together.

Let's look at an example:

inserting the values in the table

CURDATE() FUNCTION

The CURDATE function in SQL is used to return the current date. This is a built-in function that returns the current date in 'YYYY-MM-DD' format.

CURTIME() FUNCTION

The CURTIME function in SQL is used to return the current time. This is a built-in function that returns the current time in 'HH:MM:SS' format.

NOW() FUNCTION

The NOW function in SQL is used to return the current date and time. This is a built-in function that returns the current date and time in 'YYYY-MM-DD HH:MM:SS' format.