Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the date and time related functions of mysql

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly shows you the "mysql date and time related functions", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "what are the mysql date and time related functions" this article.

Function name description

ADDDATE () add date

ADDTIME () summation time

CONVERT_TZ () converts from one time zone to another

CURDATE () returns the current date

CURRENT_DATE (), synonym for CURRENT_DATE CURDATE () function

CURRENT_TIME (), synonym for CURRENT_TIME CURTIME () function

CURRENT_TIMESTAMP (), synonym for CURRENT_TIMESTAMP NOW () function

CURTIME () returns the current time

Add the two dates of DATE_ADD ()

DATE_FORMAT () specifies the date in format

Subtract the two dates of DATE_SUB ()

DATE () extracts the date portion of a date or date-time expression

Subtract the two dates of DATEDIFF ()

Synonyms for DAY () DAYOFMONTH () function

DAYNAME () returns the name of the week

DAYOFMONTH () returns the day of the month (1-31)

DAYOFWEEK () returns the weekly index of the parameter

DAYOFYEAR () returns days of the year (1-366)

EXTRACT extraction date section

The number of a FROM_DAYS () date is converted to a date

FROM_UNIXTIME () formats the date as a UNIX timestamp

HOUR () extract hour part

LAST_DAY returns the last day of the month for this parameter.

LOCALTIME (), synonym for LOCALTIME NOW () function

Synonyms for LOCALTIMESTAMP, LOCALTIMESTAMP () NOW () function

MAKEDATE () creates the date from the year and date of the year

MAKETIME MAKETIME ()

MICROSECOND () returns microseconds from the parameter

MINUTE () returns minutes from the parameter

MONTH () returns the month through the date parameter

MONTHNAME () returns the name of the month

NOW () returns the current date and time

PERIOD_ADD () add a cycle to a year and months

PERIOD_DIFF () returns the number of months between two periods

QUARTER () returns the quarter from a date parameter

SEC_TO_TIME () converts seconds to "HH:MM:SS'" format

SECOND () returns seconds (0-59)

STR_TO_DATE () converts a string to a date

SUBDATE () when calling three parameters, it is synonymous with DATE_SUB ()

SUBTIME () subtraction time

SYSDATE () returns the time when the function is executed

TIME_FORMAT () is formatted as time

TIME_TO_SEC () converts the parameter to seconds and returns

TIME () extracts the time part passed by the expression

TIMEDIFF () subtraction time

TIMESTAMP () takes an argument, and this function returns a date or date-time expression. There are two parameters, the sum of the parameters

TIMESTAMPADD () adds a time interval to the datetime expression

Interval subtracted from the date-time expression by TIMESTAMPDIFF ()

TO_DAYS () returns a date parameter that converts to a day

UNIX_TIMESTAMP () returns a UNIX timestamp

UTC_DATE () returns the current UTC date

UTC_TIME () returns the current UTC time

UTC_TIMESTAMP () returns the current UTC date and time

WEEK () returns number of weeks

WEEKDAY () returns the index of the week

WEEKOFYEAR () returns the calendar week of the date (1-53)

YEAR () returns the year

YEARWEEK () returns the year and week.

The above is all the contents of the article "what are the mysql date and time related functions?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report