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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:58:26+00:00 2026-05-31T05:58:26+00:00

I have a string in this format: Mon Feb 27 2012 13:15:00 GMT+0330 (Iraq

  • 0

I have a string in this format: Mon Feb 27 2012 13:15:00 GMT+0330 (Iraq Standard Time) ,I’m going to convert it to this format : 2012-02-27T13:15:00.000 , I’ve done this:

startTime=`Mon Feb 27 2012 13:15:00 GMT+0330 (Iraq Standard Time)`
strp_time = time.strptime(startTime, '%a %b %d %Y %H:%M:%S %Z')
start = time.strftime('%Y-%m-%dT%H:%M:%S',strp_time)

But it caused this error:

unconverted data remains: +0330 (Iraq Standard Time)

So,I tryed this to remove (Iraq Standard Time) :

start=re.sub(r' \(.+?\)$', '', startTime)
strp_time = time.strptime(start, '%a %b %d %Y %H:%M:%S %Z')
start = time.strftime('%Y-%m-%dT%H:%M:%S',strp_time)

But,I’m getting this error:

unconverted data remains: +0330
  • 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-31T05:58:28+00:00Added an answer on May 31, 2026 at 5:58 am

    If you change your regex to:

    start=re.sub(r'(\+.*)|(\-.*)$', '', startTime)
    

    It will work as you can also strip out the time zone difference information (+ or -), this should be ok for you as you are discarding the %Z data anyhow.

    You should possiblly be able to use %z to get the +0330 time difference, but it doesn’t work with my Python version, possibly due to a bug. Which seems to be resolved for Python 3.2 see http://bugs.python.org/issue6641

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

Sidebar

Related Questions

I have written this code to convert string in such format 0(532) 222 22
I have a date in String format, mm/dd/yyyy I want to convert this to
Right now I have double numba = 5212.6312 String.Format({0:C}, Convert.ToInt32(numba) ) This will give
I have some String values like this format, [INFO] [Tue Aug 21 14:54:22 2012]
I have a date string with the format 'Mon Feb 15 2010'. I want
I have string like 123-123-1234 so I want to convert string into this format
I have a string in this format dd.mm.yy (23.08.10). I would like to convert
I have a string of this format 1.0.x.0 I have to write a regex
I have a string in XML format and I want to use this string
Simple regex question. I have a string on the following format: this is 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.