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

  • Home
  • SEARCH
  • 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 687553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:08:19+00:00 2026-05-14T02:08:19+00:00

I have been search all over the net and couldn’t find an appropriate solution

  • 0

I have been search all over the net and couldn’t find an appropriate solution for this issue

OverflowError: mktime argument out of range

The code that causes this exception

 t = (1956, 3, 2, 0, 0, 0, 0, 0, 0)
 ser = time.mktime(t)

I would like to know the actual reason for this exception, some say that the date is not in a valid range but it doesn’t make any sense to me, and if there’s a range what it could be. Is it depends upon the system that we are using. Also would like to know a good solution for this issue.

Thanks.

  • 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-14T02:08:20+00:00Added an answer on May 14, 2026 at 2:08 am

    time.mktime calls the underlying mktime function from the platform’s C library. For instance, the above code that you posted works perfectly well for me on Mac OS X, although it returns a negative number as the date is before the Unix epoch. So the reason is that your platform’s mktime implementation probably does not support dates before the Unix epoch. You can use Python’s datetime module to construct a datetime object corresponding to the above date, subtract it from another datetime object that represents the Unix epoch and use the calculated timedelta object to get the number of seconds since the epoch:

    from datetime import datetime
    epoch = datetime(1970, 1, 1)
    t = datetime(1956, 3, 2)
    diff = t-epoch
    print diff.days * 24 * 3600 + diff.seconds
    

    Update: if you are using Python 2.7 or above, you could simply use print diff.total_seconds() as noted below in Chad Miller’s comment.

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

Sidebar

Related Questions

I have search all over the web but could not find answer to this
I have been writting a keyword search script based on this tutorial: http://www.hackosis.com/2007/11/06/howto-simple-search-engine-with-php-and-mysql/ Like
Over the past few days, I have been trying to find an answer to
I've been looking all over the net and asking people for guidance but nobody
Recently, I have been going through search trees and I encountered red-black trees, the
I have been trying to create a new google custom search engine, but when
I have been playing around a bit with a fairly simple, home-made search engine,
I have been running a WP site for a little over 6 months now
Recently I have encountered an issue with Scribd where searching via Scribd API (docs.search)
I have been using the Google Websearch API for over 1 year now. 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.