I want to use the NOW() function with a specific timezone, say GMT+8 for a user and GMT-2 for another user. How can I achieve this?
I am guessing that the time for NOW() is related somewhat to the timezone and time of the SQL server, but I want it to be such that FN(GMT+8) always give me the NOW() in GMT+8 irregardless of the timezone the SQL server is in.
Mini question: How do i display/know the current time of the SQL server?
The
NOW()function provides the current time in the local timezone of the server. If you wish to convert to a different timezone, you can useCONVERT_TZ()UPDATE:
You can use a per-connection timezone (that doesn’t affect the system timezone) and get the effect you want: