Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 612297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:52:40+00:00 2026-05-13T17:52:40+00:00

This sounds simple enough but I haven’t been able to figure out how to

  • 0

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 CONVERT_TZ() to convert NOW() to GMT based on the server time zone and the GMT time zone but for some reason it returns NULL when I put in the text time zones. The only way I get a result is to actually put in the offsets which is getting way too complicated for what should be a really simple operation. Here is what I mean:

mysql> SELECT CONVERT_TZ(NOW(),@@global.system_time_zone,'GMT');
NULL

mysql> SELECT CONVERT_TZ(NOW(),'PST','GMT');
NULL

mysql> SELECT CONVERT_TZ(NOW(),'-08:00','+00:00');
2010-02-13 18:28:22

All I need is a simple query to return the current time in GMT. Thanks in advance for your help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T17:52:40+00:00Added an answer on May 13, 2026 at 5:52 pm

    Just use UTC (doesnt get affected with daylight savings time)

    SELECT UTC_TIMESTAMP();
    

    Old Content for reference:

    this should work, but with

    SELECT CONVERT_TZ(NOW(),'PST','GMT');
    

    i got also NULL as result. funny enough the example in the mysql docu also returns null

    SELECT CONVERT_TZ('2004-01-01 12:00:00','GMT','MET');
    

    http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_convert-tz
    seems you found a bug in mysql. (thanks to +Stephen Pritchard)

    you could try:

    SET @OLD_TIME_ZONE=@@TIME_ZONE;
    SET TIME_ZONE='+00:00';
    SELECT NOW();
    SET TIME_ZONE=@OLD_TIME_ZONE;
    

    ok is not exactly what you wanted (its 4 queries, but only one select 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This sounds simple enough, but so far I have been unable to solve it.
This sounds like a simple enough question, but can't find the answer for the
Sounds simple enough, but its not working. In this example, I want to set
This sounds simple but my regex knowledge is limited. I need an expression to
This sounds like a really simple question, but I am new to PHP. If
Unfortunately, the answer to this question isn't quite as simple as it sounds... but
I know this sounds backwards but I would like to be able to determine
Sounds simple enough, but I'm feeling quite stupid today. If I have an array
Ok, this might sound simple but am not sure what to do. I am
This sounds confusing but isn't. Here is the problem: application is hosted at www.site.com/app

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.