DateTime objectFormatting

Nikhil Verma varma.nikhil22 at gmail.com
Wed May 2 10:49:13 EDT 2012


Hi

I am using  a  DateTimeField in my class and want to do some tweaking with
its object.

class ClinicVisitDateSettings(models.Model):
    name = models.CharField(max_length=80,blank=True,null=True)
    date_created = models.DateTimeField(blank=True,null=True)

    def __unicode__(self):
        return "%s %s" % (self.name, self.date_created.strftime("%A %B %d"))


The user fills Gen GI in name and date along with time.

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

How can achieve AM and PM also ? with this datetime object

Thanks in advance

-- 
Regards
Nikhil Verma
+91-958-273-3156
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120502/f2279b4a/attachment-0001.html>


More information about the Python-list mailing list