Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

week(NOW()) starts on Sunday Need to start on Monday

Tags:

mysql

right now I have this pulling data for the current week, but the week starts on sunday, I would like the day to start on Monday how can I do this?

$result = mysql_query("SELECT * FROM form_2 WHERE week(timestamp) = week(NOW())");
like image 856
PaperBagged Avatar asked Nov 20 '11 22:11

PaperBagged


People also ask

What is the current work week?

Week 43. Week 43 is from Monday, October 24, 2022 until (and including) Sunday, October 30, 2022.

What week is it now in 2022?

What week of the year is it? It is currently week 42 in 2022.

How do you calculate week number?

Monday or Sunday First? There are at least six different week numbering systems currently in use around the world. The most common is the International Standard ISO 8601, where Monday is the first day of the week followed by Tuesday, Wednesday, Thursday, Friday, Saturday, and with Sunday as the seventh and final day.

What is the first day of the week?

According to the international standard ISO 8601, Monday is considered the first day of the week.


2 Answers

According to the docs, use WEEK(timestamp,1)

like image 151
nos Avatar answered Sep 24 '22 05:09

nos


You could try: "SELECT * FROM form_2 WHERE week(timestamp - INTERVAL 1 DAY) = week(NOW() - INTERVAL 1 DAY)"

like image 22
toon81 Avatar answered Sep 22 '22 05:09

toon81