MySQL WEEKOFYEAR() Function

MySQL | WEEKOFYEAR() Function: Learn about the WEEKOFYEAR() function, how it works, its usages, syntax, and examples.
Submitted by Apurva Mathur, on October 13, 2022

WEEKOFYEAR() Function

The WEEKOFYEAR() function is used to get the number of weeks for the specified date. The range of this function is 1-53. According to this function, the first day of the week is Monday.

WEEKOFYEAR() Syntax

SELECT WEEKOFYEAR(datetime value);

WEEKOFYEAR() Parameter(s)

  • This function takes only one parameter i.e., datetime value. You have to provide the specified valid date.

WEEKOFYEAR() Return Value

As a result, it will return the week of the year for the date.

MySQL WEEKOFYEAR() Function Example 1

SELECT WEEKOFYEAR('2011-04-01');
Example 1: MySQL WEEKOFYEAR() Function

MySQL WEEKOFYEAR() Function Example 2

SELECT WEEKOFYEAR('2022-10-11');
Example 2: MySQL WEEKOFYEAR() Function

MySQL WEEKOFYEAR() Function Example 3

SELECT WEEKOFYEAR('2022-23-11');
Example 3: MySQL WEEKOFYEAR() Function


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.