WEEKDAY(): weekday number from 0 to 6 mysql function
Returns the Day number of the weekday from a date in the range 0 ( Monday ) to 6 ( Sunday ) .
Output is 2
Video Tutorial on Date function WEEKDAY()
This will return weekday in number of present ( today's ) date.
For a invalid date we will get Null as output
Output is NULL
DEMO: Select date from Calendar to execute WEEKDAY()
Output of WEEKDAY() function is from 0 to 6,
0 for Monday, 1 for Tuesday .... 6 for Sunday
Yesterday today and tomorrow WEEKDAY()
This query will return WEEKDAY() number of yesterday , today and tomorrow
SELECT WEEKDAY(CURDATE()- INTERVAL 1 DAY) as yesterday,
WEEKDAY(CURDATE()) as today,
WEEKDAY(CURDATE()+ INTERVAL 1 DAY) as tomorrow;
SQL Date WEEK() : Week Number in Year( 0 to 53 )
DAYOFWEEK() : Weekday Number from 1 to 7
SQL txt file for WEEKDAY()
This article is written by plus2net.com team.
▼ More on Date & Time functions in SQL