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 7862171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:01:30+00:00 2026-06-02T23:01:30+00:00

I have show times stored in all in Eastern and ID from timezone settings

  • 0

I have show times stored in all in Eastern and ID from timezone settings table. Timezone settings table has Timezone_id, GMT offset and the timezone Name.

GMT offset are stored like +6, -4, +3.5, -4.5, etc.

I am trying to write a query to pull the showtime converted to its original timezone. I am doing like this.

SELECT Date_format( CONVERT_TZ( CONVERT_TZ(A.START_TIME,  '+00:00',  '-5:00'),  
'+00:00',     CONCAT(B.GMT_OFFSET , ':00' )), '%Y-%m-%e %r:%i')  
AS  'start_time' from shows A, tz_settings B AND <<JOINS>>;

What I am doing here is first to convert the time from ET to GMT and then applying the GMT offset.

START_TIME is in date format like ‘2012-4-23 10:15:00’
Also, one more problem is converting formats like “3.5” to “3.30” to pass to Convert_TZ

EDIT: Table structure. Main fields.

   shows: 'id', 'show_name', 'stat_time', 'tz_id'
   tz_settings: 'tz_id', 'gmt_offset','tz_name'

Any ideas? Any other functions would help in the mix?

  • 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-06-02T23:01:31+00:00Added an answer on June 2, 2026 at 11:01 pm

    Don’t really know what is the problem that you are having, but I just build 2 MYSQL tables with your structure:

    MySQL Tables

    TABLE shows ['id', 'show_name', 'start_time', 'tz_id']
    TABLE tz_settings ['tz_id', 'gmt_offset','tz_name']
    

    And with this MySQL query:

    SELECT Date_format( CONVERT_TZ( CONVERT_TZ( A.START_TIME, '+00:00', '-5:00' ) , '+00:00', CONCAT( B.GMT_OFFSET, ':00' ) ) , '%Y-%m-%e %r:%i' ) AS 'start_time'
    FROM shows A, tz_settings B
    WHERE A.id =1
    AND B.tz_id = A.tz_id
    

    The result was as expected!


    Regardless, You should be storing the GMT OFFSET with it’s full format to simplify your query thus losing the CONCAT and improving performance.
    Ex.: instead of +5, store +05:00

    Does this helps you in any way ?


    EDITED TO INCLUDE MYSQL IF AND REPLACE

    SELECT Date_format( CONVERT_TZ( CONVERT_TZ( A.STAT_TIME, '+00:00', '-5:00' ) , '+00:00', if( B.GMT_OFFSET LIKE '%.5', REPLACE( B.GMT_OFFSET, '.5', ':30' ) , CONCAT( B.GMT_OFFSET, ':00' ) ) ) , '%Y-%m-%e %r:%i' ) AS 'start_time'
    FROM shows A, tz_settings B
    WHERE A.`id` =1
    AND B.`tz_id` = A.`tz_id`
    

    So, if the stored GMT OFFSET as .5 on it, it will be replaced by :30, otherwise, it will append the :00 to the existent value. (Tested and returns the value as expected)

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

Sidebar

Related Questions

I have a comment table where all the comment are stored and i want
Hi on our dev environment we have show all errors, warnings and notices. I'm
i have to show 3 columns in List view. I tried having table inside
I have a Show table, and I would like to have a derived type
I have a database table that stores document information (DocID, Name, Type, Owner, etc).
I have written a package that has a stored procedure and a REF cursor.
Here is problem I have: Table A id_a | name --------------------- 1 | name-A
I have some templates stored in my pages view directory: Pages/settings/edit_account/ basic_info.html.erb relatives.html.erb contact.html.erb
I have 2 pages that I want to show as instructions the first time
I have some text in a UITextView, that I would like to have show

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.