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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:51:18+00:00 2026-05-24T17:51:18+00:00

I wrote such a code to get timezone based on DST for an specific

  • 0

I wrote such a code to get timezone based on DST for an specific epoch time:

def getTimeZoneFromEpoch(epoch)
    if time.daylight and time.gmtime(epoch).tm_isdst==1:
        return -time.altzone/3600.0
    else:
        return -time.timezone/3600.0

But i’m not sure its correct, in fact at the moment i mistakes by 1 hour. Maybe i should swap altzone and timezone
in this code, but its not what i understood from python’s help (time module):

timezone -- difference in seconds between UTC and local standard time
altzone -- difference in  seconds between UTC and local DST time
tm_isdst
    1 if summer time is in effect, 0 if not, and -1 if unknown

Have i misundestood something?

  • 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-24T17:51:20+00:00Added an answer on May 24, 2026 at 5:51 pm

    I’ve tested this code to obtain the VM’s locale UTC offset. Which, by the way, is only really valid at the moment it is measured. I’m not sure whether your code is equivalent or not.

    def local_ephemeral_UTC_offset(epoch_time=None):
      u"Returns a datetime.timedelta object representing the local time offset from UTC at the moment"
      if epoch_time == None:
        epoch_time = time()
      return datetime.fromtimestamp(epoch_time) - datetime.utcfromtimestamp(epoch_time)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote some code to get the files in a directory. In order to
Today, I found out that you can write such code in C++ and compile
I wrote a small .NET applications that removes all line breaks in aspx/html/css code
I'm using pylons with sqlalchemy. I have several models, and found myself wrote such
I wrote a flex application that get the host string from the browser using
I wrote a very simple program in java to get used with the use
Different developers use differnt IDE in my team. One Intellij Idea user wrote code
Let's say I get the source code of some page (e.g. http://example.com ). I
Does anyone have any advice how to write such app? Or maybe knows some
I see in MSDN links such as CompareOrdinal Overloads. How can I write such

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.