How can I delete the '0' from my date day in django (python)? -


i creating django application , have next problem: have date (for example "june 3, 2001") , can't convert string date, because doesn't exist format directive in python refer day without '0'

how can caonvert "2001-06-03"?

thanks!

you can use dateutil installing pip install python-dateutil

then

>>>from dateutil import parser >>>mydate = "june 3, 2001" >>>str(parser.parse(mydate).date()) '2001-06-03' 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -