Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #32934
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.029 |
| X-Spam-Evidence | '*H*': 0.94; '*S*': 0.00; 'subject:number': 0.09; 'valueerror': 0.09; 'directive': 0.16; 'unsupported': 0.16; 'url:time': 0.16; 'wrote:': 0.17; 'subject:week': 0.17; 'thu,': 0.17; 'saying': 0.18; '>>>': 0.18; 'skip:% 10': 0.22; 'for?': 0.23; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'message- id:@mail.gmail.com': 0.27; 'convert': 0.29; 'at:': 0.31; 'url:python': 0.32; 'to:addr:python-list': 0.33; 'skip:d 20': 0.34; 'received:google.com': 0.34; 'list': 0.35; 'nov': 0.35; 'received:209.85': 0.35; 'url:org': 0.36; 'url:library': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'url:docs': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'friday': 0.71; 'subject:get': 0.81; 'to:name:python': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=0au0JoE1jCkayc3heZIOvyhd/CCyud5xDMDI9PG0SLU=; b=azWGYg42f8LcrCGTWk8LPNDe+iZJmzR1WSTUX7q7htE6FMFi9966eRB/92NyUIVSMy aKpBNYFTfXAWO4Z0xfpPbLN9TYb1WQ6imQDRqmH6TRv6Ks4GRA+eZ/9GIxL4zdR1K1iK +WStcTHsf+xxXMZEXGF3XOkJBBe69jjd96XViCpc0dIP6HWEoV9c7sz6cGtP1uRp7ZAs DogrjpXdGBpqR5vB3/yUFCth4dqpfFfSE7up2MCY7Ma3bq/LT+JML6i2MZP0ZZuAEfO1 3Hmb3m2mZuMkTZOzLkiCR4p3WB9B3uwP9Pe6Wcqq4RSNTCuNOmMEPxEKh7DBLkiaRckn 0BKw== |
| MIME-Version | 1.0 |
| In-Reply-To | <CABgq=Fz=NpZ8P8AtMmn=xAR-R1SZ1u-OL-M5iA8R5O9O6FBdVQ@mail.gmail.com> |
| References | <CABgq=Fz=NpZ8P8AtMmn=xAR-R1SZ1u-OL-M5iA8R5O9O6FBdVQ@mail.gmail.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Thu, 8 Nov 2012 00:23:07 -0700 |
| Subject | Re: get weekday as week number in a month |
| To | Python <python-list@python.org> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| 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.3423.1352359425.27098.python-list@python.org> (permalink) |
| Lines | 19 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1352359425 news.xs4all.nl 6850 [2001:888:2000:d::a6]:44978 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:32934 |
Show key headers only | View raw
On Thu, Nov 8, 2012 at 12:09 AM, Nikhil Verma <varma.nikhil22@gmail.com> wrote:
> What i want to know is if i convert it to
>
> date_object = datetime.strptime(' Friday November 9 2012 11:30PM', '%u %B %d
> %Y %I:%M%p' )
>
> It is giving me ValueError saying u is unsupported directive !
Use '%A' to match 'Friday', not '%u'. The full list of directives can
be found at:
http://docs.python.org/2/library/time.html#time.strftime
> How can i get weekday as week number ?
Is this what you're looking for?
>>> datetime.strptime('Friday November 9 2012 11:30PM', '%A %B %d %Y %I:%M%p').weekday()
4
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: get weekday as week number in a month Ian Kelly <ian.g.kelly@gmail.com> - 2012-11-08 00:23 -0700
csiph-web