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


Groups > comp.lang.python > #44216

datetime.strptime() not padding 0's

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rodrick.brown@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.051
X-Spam-Evidence '*H*': 0.90; '*S*': 0.00; 'subject:not': 0.03; "'%b": 0.16; 'isnt': 0.16; '>>>': 0.22; 'import': 0.22; 'to:name:python- list@python.org': 0.22; '&gt;&gt;&gt;': 0.24; 'skip:% 10': 0.24; 'wondering': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'run': 0.32; 'skip:d 20': 0.34; 'something': 0.35; 'received:google.com': 0.35; 'subject:skip:d 10': 0.36; 'doing': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'read': 0.60; 'pad': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:from:date:message-id:subject:to :content-type; bh=7koH9XU2m8lJpdUWJl1oH9X8mzDiR7j/Z2kAVuOB1DE=; b=Vj5aDqg5J4fQxW6sWNSeOCMdzsMcNicfXt3Srzv6t0u9+psBIp3OYPSdEvVURurEaX KjAtaRaHR4fTcgLRr32D+nRV+WqbF3ra2kq7DaUIVCtPu29ey5GhNM5lYzF9yq8kMJUL kzDS0CUJ9jxwbrlUgEcyIYnIhCRzVEmRZOPpKzbxoNdhnz8J3JiOKCwrnuD4+/9oLCeH VZEH63DbCcPayI9lWIzjwhyA3o/aGDB1Yl41ylxTjVXQQSQv2MohK1DwGKLDitqszVdE QY96zoTWn2T2FnsOur2XnTu8nsIPovWp6uIy9Q88Saip93TyYh/Z9Yur89rhJwzN6uC2 lusQ==
X-Received by 10.182.105.2 with SMTP id gi2mr17298515obb.15.1366751720602; Tue, 23 Apr 2013 14:15:20 -0700 (PDT)
MIME-Version 1.0
From Rodrick Brown <rodrick.brown@gmail.com>
Date Tue, 23 Apr 2013 17:14:50 -0400
Subject datetime.strptime() not padding 0's
To "python-list@python.org" <python-list@python.org>
Content-Type multipart/alternative; boundary=e89a8ff1cdf0cd860504db0daeae
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.995.1366751728.3114.python-list@python.org> (permalink)
Lines 35
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1366751728 news.xs4all.nl 2259 [2001:888:2000:d::a6]:45297
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:44216

Show key headers only | 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