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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:40:56+00:00 2026-05-26T12:40:56+00:00

Is there a way I can obtain a datetime aware object out of a

  • 0

Is there a way I can obtain a datetime aware object out of a string in Python using only the standard library modules ?

I know that I can use dateutil.parser.parse, but unfortunately that’s not a good enough reason to add it as a dependency to my project. I already have the mx.DateTime module as a dependency, buuttttt:

>>> dateutil.parser.parse('2011-10-24T06:51:47-07:00')
datetime.datetime(2011, 10, 24, 6, 51, 47, tzinfo=tzoffset(None, -25200))

>>> mx.DateTime.ISO.ParseDateTimeUTC('2011-10-24T06:51:47-07:00')
<mx.DateTime.DateTime object for '2011-10-24 13:51:47.00' at 29c7e48>

the ParseDateTimeUTC fails to detect the offset, even though in its documentation says that:

Returns a DateTime instance in UTC reflecting the given ISO
date. A time part is optional and must be delimited from the
date by a space or 'T'. Timezones are honored.
  • 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-26T12:40:57+00:00Added an answer on May 26, 2026 at 12:40 pm

    mx.DateTime.ISO.ParseDateTimeUTC is doing the right thing – it is applying the specified timezone to adjust the time to UTC. The resulting UTC time doesn’t have a timezone because it isn’t a local time anymore.

    The standard Python library doesn’t contain any concrete timezone classes according to the documentation:

    tzinfo is an abstract base clase, meaning that this class should not
    be instantiated directly. You need to derive a concrete subclass, and
    (at least) supply implementations of the standard tzinfo methods
    needed by the datetime methods you use. The datetime module does not
    supply any concrete subclasses of tzinfo.

    I’ve always been surprised that they didn’t at least include a class for UTC, or a generic implementation like dateutil’s tzoffset.

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

Sidebar

Related Questions

Is there way that I can read the file from remote server using fopen
Is there any way we can fetch X509 Public Cetrificates using c# from AD
is there any way I can obtain installed fonts as a list (or array,
Is there any way can declare a bean in just like JSP UseBean in
Is there any way I can set a formatter on models that will convert
Is there a way I can use one category to stylize all of my
Is there a way I can detect an image URL, like: http://mysite.com/image.jpg but with
Is there a way I can change the icon of the expander to +/-
Is there a way I can add support for syncing my program's settings with
Is there any way I can use JPA or hibernate annotations to specify 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.