Turning a string into a datetime object

I think that all computer languages should be judged on how they handle dates and time in their standard library.  But then, most fail.

Python’s support improved greatly with the datetime but getting a string massaged into a datetime takes some doing.  This is what I came up with:

dateTup = time.strptime(dateStr,”%B %d, %Y”)  rssItem.pubDate = datetime.datetime( year=dateTup[0], month=dateTup[1], day=dateTup[2], )

Leave a Reply

You must be logged in to post a comment.