Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use WEEK function in MySQL

Shulou Source: shulou.com Published: 2022-06-01 02:43:23 10月03日 Update

This article mainly introduces how to use the WEEK 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.

WEEK (date,index)

SELECT WEEK ('2016-01-03') SELECT WEEK ('2016-01-03, 0) SELECT WEEK (' 2016-01-03, 1)-> 1 (this function returns the week ordinal of date, date (01.03) is Sunday, the default is Sunday as the first day of the week, the function returns 1 here can be understood in two ways: 1, return 0 in the first week, return 1 in the second week. 2. Start counting with the full week of the year. The first week returns 1, the second week returns 2, and the last week returns 53)-> 1 (the default index of week () is 0. So the results are the same as above)-> 0 (when index is 1, the first day of the week is Monday, so Monday the 4th is the beginning of the second week.) Thank you for reading this article carefully. I hope the article "how to use the WEEK function in MySQL" shared by the editor will be helpful to you. At the same time, I hope you will support us, pay attention to the industry information channel, and more related knowledge is waiting for you to learn!

Tags: Function article value interest at the same time that is more friends knowledge results editing industry information information channels channels references learning help support Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Huawei Redmi Shulou Tech Info Shulou Information