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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:09:11+00:00 2026-05-27T10:09:11+00:00

I have a lot of existing code that just uses the normal dateTime class

  • 0

I have a lot of existing code that just uses the normal dateTime class in python, however in upgrading my program I am using the QtGui.QdateTimeEdit() class, but that class returns a QdateTime object that seems to be incompatible with the normal dateTime object.

So, is there a sane way to convert QdateTime to normal python dateTime? Other then breaking it into its parts and recreating a normal dateTime object from that? I am using PyQt4 with Python 3.2. 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-27T10:09:12+00:00Added an answer on May 27, 2026 at 10:09 am

    QDateTime has a toPyDateTime method which will return regular datetime objects.

    In : from PyQt4 import QtCore
    
    In : QtCore.PYQT_VERSION_STR
    Out: '4.8.6'
    
    In : QtCore.QT_VERSION_STR
    Out: '4.7.4'
    
    In : now = QtCore.QDateTime.currentDateTime()
    
    In : now
    Out: PyQt4.QtCore.QDateTime(2011, 12, 11, 20, 12, 47, 55)
    
    In : now.toPyDateTime()
    Out: datetime.datetime(2011, 12, 11, 20, 12, 47, 55000)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a current existing project repository that has a lot of code that
For whatever reason, I have a lot of clients that have existing data that's
I am trying to migrate existing code that uses XmlSerializer to protobuf-net due to
I have project where i'm developing an Android App using a lot of existing
I have a lot of pre-existing BMPs (and our clients have pre-existing bmps as
Have a lot of unnecessary results using contains() method in my query. Don't tell
I have a lot of constants that are somehow related, at some point I
Say I want a have a C program that does this: 1. User will
I've seen and worked with a lot of older, JDBC-based DAO code that usually
I've won the task of restructuring/recreating an existing code repository, either using Git or

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.