Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #44216

datetime.strptime() not padding 0's

From Rodrick Brown <rodrick.brown@gmail.com>
Date 2013-04-23 17:14 -0400
Subject datetime.strptime() not padding 0's
Newsgroups comp.lang.python
Message-ID <mailman.995.1366751728.3114.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

I thought I read some where that strptime() will pad 0's for day's for some
reason this isnt working for me and I'm wondering if i'm doing something
wrong.

>>> from datetime import datetime
>>> dt = datetime.strptime('Apr 9 2013', '%b %d %Y')
>>> dt.day
9
>>>

How can I get strptime to run 09? instead of 9


--RB

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

datetime.strptime() not padding 0's Rodrick Brown <rodrick.brown@gmail.com> - 2013-04-23 17:14 -0400
  Re: datetime.strptime() not padding 0's John Gordon <gordon@panix.com> - 2013-04-23 21:38 +0000

csiph-web