WEEKOFYEAR(): function in a mysql date and time field

Returns the Week Number of the year from a date .
Syntax
WEEKOFYEAR(date)
Example
SELECT WEEKOFYEAR('2015-08-21')
Output is 34

By using CURDATE() we can get present week number of the year.
SELECT WEEKOFYEAR( CURDATE( ) )

For a invalid date we will get Null as output
SELECT WEEKOFYEAR('2015-02-31')
Output is NULL
WEEKDAY() function to get number from 0 to 6 based on Weekday in MySQL

Monday is the starting day of the week.
This function is same as WEEK() function when mode is equal to 3
Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com



    Post your comments , suggestion , error , requirements etc here .





    SQL Video Tutorials










    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2023 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer