Or rather :

{% for a in entries %}
 Date: {{ a.date|date:"jS o\f F" }}<br />
{% endfor %}


--
David


Begin forwarded message:

From: David Marquis <[EMAIL PROTECTED]>
Date: March 2, 2008 8:15:00 PM EST (CA)
To: django-users@googlegroups.com
Subject: Re: How to display a date in my template as Mar. 1 2008...not 2008-03-01?

You forgot the pipe | character and the colon :

{% for a in entries %}
 Date: {% a.date|date:"jS o\f F" %}<br />
{% endfor %}


If a is your date, then:

{% for a in entries %}
 Date: {% a|date:"jS o\f F" %}<br />
{% endfor %}


Have you read the docs? They are pretty clear about the syntax of template filters.

--
David

On 2-Mar-08, at 1:14 PM, Greg wrote:


Alex,
I tried that however I get the following error: TemplateSyntaxError:
Invalid block tag: 'a.date'

Here is my template

{% for a in entries %}
 Date: {% a.date "jS o\f F" %}<br />
{% endfor %}



On Mar 2, 12:03 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
Use the date filter:http://www.djangoproject.com/documentation/templates/#date

On Mar 2, 11:57 am, Greg <[EMAIL PROTECTED]> wrote:

I'm querying a table in my db.  Each record that gets returned
contains a DateField (the date it was created). I'm able to show the date in the template...however I want to change the format it's being displayed as. In this case it's 2008-03-01. I want the date to show
Mar. 1 2008.

Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---



Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to