Convert string into datetime type
Question: > **Possible Duplicate:**  
>  [Convert Date String to DateTime Object in
> Python](http://stackoverflow.com/questions/2721782/convert-date-string-to-
> datetime-object-in-python)

Is there an easy way to convert the string the string `10/22/1984` into a
datetime.date object?


Answer: You can use datetime.strptime method for this purpose:

    
    
    from datetime import datetime
    
    dVal = datetime.strptime('10/22/1984', '%m/%d/%Y')
    

You can read more using the [following link that describes python strptime
behavior](http://docs.python.org/library/datetime.html?highlight=datetime.strptime#strftime-
strptime-behavior).

