On Thu, Nov 8, 2012 at 12:09 AM, Nikhil Verma <varma.nikhi...@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
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to