Hàm YEARWEEK() của MySQL
❮ Hàm MySQL
Ví dụ
Trả về số năm và tuần cho một ngày:
SELECT YEARWEEK("2017-06-15");
Hãy tự mình thử »
Định nghĩa và cách sử dụng
Hàm YEARWEEK() trả về số năm và số tuần (một số từ 0 đến 53) cho một ngày nhất định.
Cú pháp
YEARWEEK( date , firstdayofweek )
Giá trị tham số
Parameter |
Description |
date |
Required. The date or datetime value to extract the
year and week number from |
firstdayofweek |
Optional. Specifies what day the week starts on. Can be one of the
following:
- 0 - First day of week is Sunday
- 1 - First day of week is Monday and the first week has more than 3
days
- 2 - First day of week is Sunday
- 3 - First day of week is Monday and the first week has more than 3
days
- 4 - First day of week is Sunday and the first week has more than 3
days
- 5 - First day of week is Monday
- 6 - First day of week is Sunday and the first week has more than 3
days
- 7 - First day of week is Monday
|
Chi tiết kỹ thuật
Hoạt động trong: | Từ MySQL 4.0 |
---|
Thêm ví dụ
Ví dụ
Trả về số năm và tuần cho một ngày:
SELECT YEARWEEK("2017-10-25");
Hãy tự mình thử » Ví dụ
Trả về số năm và tuần cho ngày hệ thống hiện tại:
SELECT YEARWEEK(CURDATE());
Hãy tự mình thử »
❮ Hàm MySQL
Người tìm đường W3schools
Theo dõi tiến trình của bạn - hoàn toàn miễn phí!