In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use the DATE_ADD function in MySQL, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand it.
DATE_ADD (date,INTERVAL number type), same as ADDDATE ()
SELECT DATE_ADD ("2015-12-31 23:59:59", INTERVAL 1 SECOND) SELECT DATE_ADD ("2015-12-31 23:59:59", INTERVAL 1 DAY) SELECT DATE_ADD ("2015-12-31 23:59:59", INTERVAL "1:1" MINUTE_SECOND) SELECT DATE_ADD ("2016-01-01 00:00:00" INTERVAL "- 1 10" DAY_HOUR)-> 2016-01-01 0000-> 2016-01-01 23-059-> 2016-01-01 00-01-01 00-01-0100-> 2015-12-30 14:00:00
DATE_ADD () and ADDDATE () return the result of the date operation
1. The format of date can be "15-12-31", "15-12-31 23:59:59" or "2015-12-31 23:59:59". If the parameter date is in date format, the result will be returned in date format. If the parameter date is in datetime format, the result in datetime format will be returned.
2. Type format:
SECOND second SECONDS
MINUTE minute MINUTES
HOUR time HOURS
DAY days DAYS
MONTH monthly MONTHS
YEAR year YEARS
MINUTE_SECOND minutes and seconds "MINUTES:SECONDS"
HOUR_MINUTE hours and minutes "HOURS:MINUTES"
DAY_HOUR days and hours "DAYS HOURS"
YEAR_MONTH year and month "YEARS-MONTHS"
HOUR_SECOND hours, minutes, "HOURS:MINUTES:SECONDS"
DAY_MINUTE days, hours, minutes "DAYS HOURS:MINUTES"
DAY_SECOND days, hours, minutes, seconds "DAYS HOURS:MINUTES:SECONDS"
3. In addition, if you do not use a function, you can also consider using the operator "+", "-". The example is as follows:
SELECT "2016-01-01"-INTERVAL 1 SECOND SELECT "2016-01-01"-INTERVAL 1 DAY SELECT '2016-12-31 23 INTERVAL 59' + INTERVAL 1 SECOND SELECT '2016-12-31 23 23 Fraser 59' + INTERVAL "1:1" MINUTE_SECOND
Return the result:
Thank you for reading this article carefully. I hope the article "how to use the DATE_ADD function in MySQL" shared by the editor will be helpful to all of you. At the same time, I hope you can support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.