MySQL date/time Functions

This page contains a list of MySQL date/time functions that can be used to manipulate temporal values. The following table contains the functions with a brief description.

List of MySQL date/time Functions

Function Description
ADDDATE() Add time values (intervals) to a date value
DATE_ADD() Add time values (intervals) to a date value
DATE() Extract the date part of a date or datetime expression.
CURDATE() It is used to get the current date.
CURRENT_DATE() It's a synonyms for CURDATE() function.
DATEDIFF() It returns the difference between two dates.
DAY() It is used to get the day of the month.
DAYOFMONTH() It is used to get the day of the month.
DAYNAME() It is used to get the name of the weekday.
DAYOFWEEK() It is used to get the weekday index of the argument.
DAYOFYEAR() It is used to get the day of the year (1-366).
FROM_DAYS() It is used to convert a day number to a date.
HOUR() It is used to extract the hour.
ADDTIME() This function is used to add times.
CURRENT_TIME() This function is used to get the current time.
CURRENT_TIMESTAMP() This function is used to get the current date and time.
CURTIME() This function is used to get the current time.
LAST_DAY() This function is used to get the corresponding value for the last day of the month.
LOCALTIME() This function is used to get the current time.
LOCALTIMESTAMP() This function is used to get the current time.
MAKEDATE() This function is used to create a date from the year and day of year.
MAKETIME() This function is used to create time from hour, minute, second.
MICROSECOND() This function is used to get the microseconds from the given argument (datetime).
MINUTE() This function is used to get the minutes value from the given argument (datetime).
MONTH() This function is used to get the month's value from the given argument (datetime).
MONTHNAME() This function is used to get the name of the month.
NOW() This function is used to get the current date and time.
PERIOD_ADD() This function is used to add a period to a year-month.
PERIOD_DIFF() This function is used to get the number of months between the given periods.
QUARTER() This function is used to get the quarter from a date argument.
SEC_TO_TIME() This function is used to convert seconds to 'hh:mm:ss' format.
SECOND() This function is used to get the second's value from the given argument between 0-59.
DATE_FORMAT() This function is used to format date as specified.
TIME() This function is used to extract the time portion from the given expression.
TIME_FORMAT() This function is used to format as time.
TIME_TO_SEC() This function is used to get the given argument converted to seconds.
TIMEDIFF() This function is used to subtract the given times.
TIMESTAMP() This function is used to get the date or datetime expression if there is a single argument, if there are two arguments this function is used to get the sum of the given arguments.
TO_DAYS() This function is used to convert the given date argument into days.
STR_TO_DATE() This function is used to convert a string to date.
SUBDATE() This function is used to subtract a time value (interval) from a date.
SUBTIME() This function is used to subtract times.
SYSDATE() This function is used to get the time at which the function executes.
WEEK() This function is used to get the week number.
WEEKDAY() This function is used to get the week index.
WEEKOFYEAR() This function is used to get the calendar week of the date (1-53).
YEAR() This function is used to get the year value of the given argument (date).
YEARWEEK() This function is used to get the year and week.

Reference(s)




Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.