datetime - How do I convert dates from "Month DD,YY" to "MM/DD/YY" in python? -


how convert april 28,2015 04/28/15 in python? can assign april = 4 not april 04. how do that?

c:> pip install python-dateutil c:> python ... >>> dateutil.parser import parse >>> print "stack overflow saved bacon on:",parse("april 28,2015").strftime("%m/%d/%y") 

if sure of format, of course specify exactly:

>>> import datetime >>> print datetime.datetime.strptime("%b %d,%y","april 28,2015").strftime("%m/%d/%y") 

Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -