0

I have this query, how can in change the timezone to an indian timezone in this query

SELECT 'ENTRIES' as Module, concat(SUM(t.TotalEntry)) AS VAL 
FROM fantasy.Game t 
WHERE t.DateModified BETWEEN CONCAT(CURDATE(),' 00:00:01') 
                         AND CONCAT(CURDATE(),' 10:00:00')
Akina
  • 39,301
  • 5
  • 14
  • 25
Yogesh
  • 13
  • 6
  • i'm using MySQL – Yogesh Jun 01 '22 at 06:00
  • The syntax claims that you use MySQL. So: #1. Use TIMESTAMP() function, not CONCAT; #2. For timezone changing use CONVERT_TZ() function; #3. In `concat(SUM(t.TotalEntry))` the CONCAT usage is excess - remove it. – Akina Jun 01 '22 at 06:01
  • Does this answer your question? [How to Convert UTC Date To Local time Zone in MySql Select Query](https://stackoverflow.com/questions/15017799/how-to-convert-utc-date-to-local-time-zone-in-mysql-select-query) – Damini Suthar Sep 02 '22 at 05:32

1 Answers1

0

In MySQL the CONVERT_TZ() returns a resulting value after converting a datetime value from a time zone specified as the second argument to the time zone specified as the third argument. This function returns NULL when the arguments are invalid.

Syntax:

CONVERT_TZ(dt, from_tz, to_tz)

from_tz and to_tz are timezone variables and could be numeric or timezone name. Look at this link for more datail:

Official MySql documentation

Alessandro
  • 129
  • 1