MySQL get ALL columns within the current week, converted from UTC to timezoneX

Issue

This Content is from Stack Overflow. Question asked by MasonBarno

I try to form a query to return all columns but its not working

SELECT * from mycalendar WHERE WEEK(datetime)=week(now()); //this returns everything however the date/time is stored in UTC in the database so it will miss anything that could be in the same week but in UTC its already the next week.

The following will return all the correct values adjusted for timezone but I need all columns, instead I get both of the same columns.
SELECT CONVERT_TZ(datetime, '+00:00', '-05:00') AS localdatetime, (select localdatetime WHERE WEEK(localdatetime)=week(now())) FROM mycalendar;



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?