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

The method of getting date by MySQL

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

Share

Shulou(Shulou.com)06/01 Report--

The following mainly brings you the method of getting the date by MySQL. I hope that the method of getting the date by MySQL can bring you practical use, which is also the main purpose of my editing this article. All right, don't talk too much nonsense, let's just read the following.

Select curdate ();-- get the current date

Select last_day (curdate ());-- gets the last day of the month (based on the current date).

Select DATE_ADD (curdate (), interval-day (curdate ()) + 1 day);-- get the first day of the month (based on the current date)

Select date_add (curdate ()-day (curdate ()) + 1 Magi interval 1 month);-- get the first day of the next month (based on the current date)

Select DATEDIFF (date_add (curdate ()-day (curdate ()) + 1 language interval 1 month), DATE_ADD (curdate (), interval-day (curdate ()) + 1 day) days from dual;-gets the number of days in the current month (based on the current date)

For the above method of getting the date by MySQL, do you think it is very helpful? If you need to know more, please continue to follow our industry information. I'm sure you'll like it.

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