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 is the Mysql date function

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

Share

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

The following is to understand what is the Mysql date function, I believe that we will benefit a lot after reading, the text is not much in the essence, hope that what is the Mysql date function of this short content is what you want.

Today's time [2016-12-21]

Get yesterday date yyyy-mm-dd

Select date_sub (curdate (), interval 1 day)

2016-12-20

Get yesterday's month

Select DATE_FORMAT (curdate (),'% Ymuri% m')

2016-12

Date conditions: 12 months of history

Date conditions: 12 months of history. = take [the 1st of the month where the current day is located as the end deadline] and [the 1st of the current month pushed forward 12 months] as the start time [start, end)

Select DATE_FORMAT (date_sub (curdate (), interval 12 month),'% Ymuri% mmur01') AS start_time, DATE_FORMAT (curdate (),'% Ymuri% mmur01') AS end_time

Start_timeend_time2015-12-012016-12-01

From the beginning of the month to yesterday. | | from the 1st to yesterday [start, end] month to date | |

Select DATE_FORMAT (curdate (),'% Ymuri% mmur01') AS start_time, curdate () AS end_time

Start_timeend_time2016-12-012016-12-21

Get yyyymm of year and month

Select extract (YEAR_MONTH from curdate ()) as yyyymm

201612

After reading what is Mysql date function, many readers will want to know more about it. If you need more industry information, you can follow our industry information section.

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