DAY() Examples – MySQL

In MySQL, the DAY() function is a synonym for the DAYOFMONTH() function. It’s used to return the day of the month from a date.

In this context the “day of the month” is a value between 1 and 31, or 0 for dates with a zero day part. For example, if you provide a date of 2020-05-03, the DAY() function will return 3.

Read more

DAYOFMONTH() Examples – MySQL

You can use the DAYOFMONTH() function in MySQL to return the day of the month from a date.

By “day of the month”, I mean a value between 1 and 31 (or 0 for dates with a zero day part), as opposed to the day of the week, such as Monday etc.

For example, if you provide a date of 2018-01-07, the DAYOFMONTH() function will return 7.

Read more

SYSDATE() Examples – MySQL

The MySQL SYSDATE() function returns the current date and time. The value is returned in ‘YYYY-MM-DD HH:MM:SS’ or YYYYMMDDHHMMSS format, depending on whether the function is used in a string or numeric context.

This function is similar to NOW() but with a subtle difference. SYSDATE() returns the time at which it executes. NOW() returns the time at which the statement started executing.

Read more

CURRENT_TIME Examples – MySQL

In MySQL, the CURRENT_TIME function can be used to return the current time.

This function is actually a synonym for CURTIME() which returns the current time, so you can choose which function you prefer to use.

Both functions return the current time as a value in ‘HH:MM:SS’ or HHMMSS format, depending on whether the function is used in a string or numeric context.

Read more