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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:46:39+00:00 2026-05-25T21:46:39+00:00

What I mean is that there are different timezones with the same name, like

  • 0

What I mean is that there are different timezones with the same name, like CST (-06:00 in US and +09:30 in Australia). Accordingly conversion to utc gives wrong results for Adelaide.

Any elegant way to solve this?

  • 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-25T21:46:39+00:00Added an answer on May 25, 2026 at 9:46 pm

    an easy way would be that you use the other nomenclature of naming time zones..
    e.g. for UTC+9:30 intstead of using CST, you can use “Australia/Adelaide”

    tz = TZInfo::Timezone.get("Australia/Adelaide")
    
    t = Time.now   # you could also get the UTC time here with Time.now.utc
    t.zone
     => "PDT" 
    t.utc_offset
     => -25200 
    t.in_time_zone(tz)    # this is a Rails extension of the Time class
     => Sat, 01 Oct 2011 14:31:05 CST +09:30 
    t.in_time_zone(tz).zone
     => "CST" 
    t.in_time_zone(tz).utc_offset
     => 34200 
    

    See:
    http://api.rubyonrails.org/classes/Time.html

    http://tzinfo.rubyforge.org/doc/

    http://en.wikipedia.org/wiki/List_of_tz_database_time_zones


    do a “gem install activesupport”, and in your script:

    require 'rubygems'
    require 'tzinfo'
    require 'active_support'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Haskell, lifted type products mean that there's a semantic difference between (a,b,c) and
I only have experience with log4net however that does not mean that there are
Is there a function, that clears last line in command prompt? I dont mean
I know that there are tons of questions like this one, but I couldn't
When restoring a SQL Server Database, I notice that there are 3 different Recovery
By alignment I mean that the predicate takes in two lists, well three with
Is there anything built into the core C# libraries that can give me an
Does that mean that I can't share a Form between delphi 2007 and 2009?
What exactly does immutable mean - that is, what are the consequences of an
What does it mean that a Transaction Log is Full? I have it the

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.