This sounds simple enough but I haven\'t been able to figure out how to use a simple SELECT statement to return the current time in GMT.
I have been trying to use CO
When the source server timestamp is unknown but the requirement is for a specific tz do this:
select convert_tz(utc_timestamp(),'+05:00','+00:00')
This uses CST as an example. utc_timestamp will guarantee a '+00:00' result no matter where you query it. The '+05:00' is your desired offset. This works great when hitting multiple unknown servers and it assures you that you returning result will all be in a common tz result set.
I was searching for my time zone which is GMT+6 (Asia/Dhaka TimeZone)
MySQL server is in US. The below worked for me.
SELECT CONVERT_TZ( UTC_TIMESTAMP( ) , '+06:00', '+00:00' )
After seeing all the answers above and seeing it's unreliable to convert to PST, I just used this:
DATE_SUB(user_last_login, INTERVAL 7 hour)