sam
sam

Reputation: 19164

datetime conversion using python

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?

Upvotes: 0

Views: 411

Answers (1)

mensi
mensi

Reputation: 9826

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'))

Upvotes: 4

Related Questions