0

I have date as

'Apr, 2012'   

I want to convert it to the "mx datetime" object.

Can anyone tell me how to convert the same?

2
  • 1
    Presumably you are talking about the eGenix mxDateTime library, rather than Python's built-in datetime module. Commented Apr 10, 2012 at 11:55
  • 1
    What have you tried? I believe the mx strptime function works the same as the python stdlib's datetime.datetime.strptime function, so this should be a very straight forward operation. Commented Apr 10, 2012 at 11:57

1 Answer 1

4

You can use dateutil.parser to parse dates to python datetime objects:

from dateutil.parser import parse
from mx.DateTime import DateFrom
date = DateFrom(parse('Apr, 2012'))
Sign up to request clarification or add additional context in comments.

1 Comment

I am looking for "mx datetime objects"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.