MySQL Date/Time week() Function

The week() is a MySQL date/time function. It is used to get the week portion from given date.

Syntax

Parameter:

Date_value : date for getting week

Mode : it is optional. It is used to specify what day the week starts on. It can be one of the following:

ModeExplanationReturns
0First day of the week is Sunday0-53
1First day of the week is Monday and the first week has more than 3 days0-53
2First day of the week is Sunday1-53
3First day of the week is Monday and the first week has more than 3 days1-53
4First day of the week is Sunday and the first week has more than 3 days0-53
5First day of the week is Monday0-53
6First day of the week is Sunday and the first week has more than 3 days1-53
7First day of the week is Monday1-53

Returns:

This function returns the week portion of a date value.

Example 1

Output:


MySQL Datetime week() Function

Example 2

Output:


MySQL Datetime week() Function
Next TopicMySQL datetime




Latest Courses