1
I’ve been looking for a mysql command that does such a function. The purpose of this is that I have to display a current week’s item schedule. From Sunday to Saturday. Is there a query that makes this filter ? Well the column is date, Y-m-d.
1
I’ve been looking for a mysql command that does such a function. The purpose of this is that I have to display a current week’s item schedule. From Sunday to Saturday. Is there a query that makes this filter ? Well the column is date, Y-m-d.
3
Use the function YEARWEEK
together with the CURDATE
:
SELECT *
FROM tabela
WHERE YEAR(data) = YEAR(CURDATE())
AND YEARWEEK(data, 1) = YEARWEEK(CURDATE(), 1)
Returns the year for date, in the range 1000 to 9999, or 0 for the "zero" date.
In free translation:
Returns the year of a date, in a range from 1000 to 9999, or 0 for the date "zero".
Returns year and week for a date.
In free translation:
Returns the year and week of a date.
Returns the Current date as a value in 'YYYY-MM-DD' or YYYYMMDD format, Depending on whether the Function is used in a string or Numeric context.
In free translation:
Returns the current date as the value in the format 'YYYY-MM-DD' or YYYYMMDD, depending on the context in which the function is used (string or numeric).
Browser other questions tagged mysql database
You are not signed in. Login or sign up in order to post.
Have you tried using WEEK()? Connect to this https://stackoverflow.com/questions/6710342/mysql-grouping-by-week
– Márcio Cristian
Yes, but she won’t return any record to me
– Atila Silva