python: converting datetime format
Question: I have the following format:

`"Wed Jun 25 15:38:29 PDT 2014"` and I would like to convert it to
`"2014-06-25 15:38:29"`, i.e. `"%Y-%m-%d %H:%M:%S"`

Code:

    
    
    import time
    
    import datetime
    
    
    rawtime = "Wed Jun 25 15:38:29 PDT 2014"
    
    dt = time.strptime(rawtime, "%Y-%m-%d %H:%M:%S")
    
    print dt
    

I get the error:

    
    
    ValueError: time data 'Wed Jun 25 15:38:29 PDT 2014\n' does not match format '%Y-%m-%d %H:%M:%S'
    


Answer: Simplest solution using [dateutil](http://labix.org/python-dateutil) package.
It really is excellent at this.

    
    
    from dateutil import parser
    print parser.parse("Wed Jun 25 15:38:29 PDT 2014")
    

Output:

    
    
    2014-06-25 15:38:29
    

