Hàm MySQL WEEK()
❮ Hàm MySQL
Định nghĩa và cách sử dụng
Hàm WEEK() trả về số tuần của một ngày nhất định (một số từ 0 đến 53).
Cú pháp
WEEK( date , firstdayofweek )
Giá trị tham số
Parameter |
Description |
date |
Required. The date or datetime to extract the
week number form |
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 of the year has more than 3
days
- 2 - First day of week is Sunday
- 3 - First day of week is Monday and the first week of the year has more than 3
days
- 4 - First day of week is Sunday and the first week of the year has more than 3
days
- 5 - First day of week is Monday
- 6 - First day of week is Sunday and the first week of the year 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ố tuần cho ngày hệ thống hiện tại:
SELECT WEEK(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í!