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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:59:46+00:00 2026-06-17T15:59:46+00:00

I have working code. My question is why does this work? #04/13/05 2:30pm EDT

  • 0

I have working code. My question is why does this work?

#"04/13/05 2:30pm EDT" <- original date string
from datetime import datetime, timedelta
from pytz import timezone
import pytz
import time

T= time.struct_time((2005,4,13,14,30,0,0,0,1))
t = time.mktime(T)

print(t)

this prints

1113417000, 

which according to an online converter, http://www.epochconverter.com/, prints

Your time zone: 4/13/2005 2:30:00 PM GMT-4

which is correct. My question is, how does it know the time was in EDT which is GMT-4? The last of the 9-tuple is “dst flag”, but there are numerous timezones where DST is used. So how does it detect the correct timezone?

  • 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-17T15:59:47+00:00Added an answer on June 17, 2026 at 3:59 pm

    It asks your operating system for that information, by way of the stdlib C time functions.

    To quote the time module documentation:

    Most of the functions defined in this module call platform C library functions with the same name. It may sometimes be helpful to consult the platform documentation, because the semantics of these functions varies among platforms.

    You can pass in a -1 for the DST flag to have the library set it for you, see time.struct_time. On my Mac OS X 10.7.5 setup, configured for the Europe/Oslo timezone, that gives me:

    >>> import time
    >>> time.mktime((2005,4,13,14,30,0,0,0,-1))
    1113395400.0
    

    or, as ‘translated’ by epochconverter:

    Your time zone: 4/13/2005 2:30:00 PM GMT+2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on some JQuery code and I have a question about caching selectors.
I have this working code, but now i need to be able to change
I have this (working) CPU code: #define NF 3 int ND; typedef double (*POT)(double
As a beginner in Ocaml, I have this current working code: ... let ch_in
I have this code working in C#: var request = (HttpWebRequest)WebRequest.Create(https://x.com/service); request.Method = GET;
Disclaimer: I apologize that this question is so long. I have added code as
I have been working on Google AdWords and came across this code adwords-api-6.4.0, com.google.api.adwords.lib.AdWordsUser
I already know how to make this code work, but my question is more
I have working code of js, it shows different div for selected option. <html>
I have some working code with a crutch to add BOM marker to a

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.