TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

MySQL week() Function

MySQL week() Function with Examples for beginners and professionals on mysql tutorial, mysql function, mysql date time, ADDDATE(), ADDTIME(), CONVERT_TZ(), CURDATE(), CURTIME(), DATE(), TIME() DATE_ADD(), DATE_FORMAT(), TIME_FORMAT(), TIMESTAMP(), TO_DAYS(), WEEK() etc.

<< Back to MYSQL

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

select week(date_value, [mode]);

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:

Mode Explanation Returns
0 First day of the week is Sunday 0-53
1 First day of the week is Monday and the first week has more than 3 days 0-53
2 First day of the week is Sunday 1-53
3 First day of the week is Monday and the first week has more than 3 days 1-53
4 First day of the week is Sunday and the first week has more than 3 days 0-53
5 First day of the week is Monday 0-53
6 First day of the week is Sunday and the first week has more than 3 days 1-53
7 First day of the week is Monday 1-53

Returns:

This function returns the week portion of a date value.

Example 1

select week('2018-10-03');

Output:


MySQL Datetime week() Function

Example 2

select week('1995-02-11');

Output:


MySQL Datetime week() Function
Next TopicMySQL datetime




Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf