DateTime objectFormatting
Jerry Hill
malaclypse2 at gmail.com
Wed May 2 10:57:00 EDT 2012
On Wed, May 2, 2012 at 10:49 AM, Nikhil Verma <varma.nikhil22 at gmail.com> wrote:
> What i am able to achieve with this class object to return is :-
>
> Gen GI Monday May 7
>
> I want that the this class should return object like this :-
>
> Gen GI Monday AM, May 7
> Pancreas Tuesday PM, May 8
Check the documentation for the strftime method:
http://docs.python.org/library/datetime.html#strftime-and-strptime-behavior
That has a list of the various formatting directives that can be used
to lay out your date and time as you wish.
In this case, instead of "%A %B %d", you probably want "%A %p, %B %d".
That is, Full Weekday Name, followed by the AM/PM marker, then a
comma, then the Full Month Name and the day of month.
--
Jerry
More information about the Python-list
mailing list