CBSE CS and IP

CBSE Class 11 & 12 Computer Science and Informatics Practices Python Materials, Video Lecture

MySQL Date Functions

 

MySQL Date Functions

For preforming the operations on dates, MySQL has provided some function:

1. NOW ()

NOW function returns the current date and time.

Syntax:
NOW( )

2. DATE ()

DATE function extracts the date value from a date or datetime expression.

Syntax:
DATE( expression )

Parameter or Arguments:
expression: The date or datetime value from which the date should be extracted.

3. MONTH ()

MONTH function returns the month portion of a date value.

Syntax:
MONTH( date_value )

Parameter or Arguments:
date_value: A date or datetime value from which to extract the month.

4. MONTHNAME ()

MONTHNAME function returns the full name of the month for a date.

Syntax:
MONTHNAME( date_value )

Parameter or Arguments:
date_value: A date or datetime value from which to extract the full month name.

5. YEAR ()

YEAR function returns the year portion of a date value.

Syntax:
YEAR( date_value )

Parameter or Arguments:
date_value: A date or datetime value from which to extract the year.

6. DAY ()

DAY function returns the day portion of a date value.

Syntax:
DAY( date_value )

Parameter or Arguments:
date_value: The date or datetime value from which to extract the day.

7. DAYNAME ()

DAYNAME function returns the weekday name for a date.

Syntax:
DAYNAME( date_value )

Parameter or Arguments:
date_value: The date or datetime value from which to extract the weekday name.



No comments:

Post a Comment