Jong-Guk Ahn
Jong-Guk Ahn

Reputation: 31

How can I omit time at HTML {{ post.published_date }} tag?

How can I omit time at HTML {{ post.published_date }} tag?

I use Python and Django, I tried showing the published date, but I don't want to display time.

<!--html file-->
<a href="{% url 'post_detail' pk=post.pk %}">{{ post.title }} ... &nbsp {{ post.published_date }}</a>

e.g.

what I have:

  • This is post title ... Nov. 19, 2019 p.m. 5:37
  • This is post title, too! ... Nov. 24, 2019 a.m. 2:30

what I want:

  • This is post title ... nov. 19, 2019
  • This is post title, too! ... nov. 24, 2019

Upvotes: 3

Views: 134

Answers (1)

Arjun Shahi
Arjun Shahi

Reputation: 7330

If you want only date in the template try this. See the docs for more info

{{ post.published_date|date }}

Upvotes: 8

Related Questions