Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

How to properly display the format of date time in Django?

$
0
0

I want to add the date and time when I uploaded a specific file in my database in Django. In my models.py, I added this line of code:

models.py

date_added = models.DateTimeField(auto_now_add=True)

In the template, I added this code:

{% block content %}<div class="container"><tr><td>        CAR LIST</td><td>        Date Added</td></tr>{% for car in cars %}<tr><td><a href="{% url 'show-car' car.car_id %}">{{ car }}</a></td><td>{{ car.date_added }}</td></tr>{% endfor %}</div>{% endblock %}

It correctly displays the date however the time only shows "midnight". How do I format the datetime into Month, Day, Year, Hours, Minutes, Seconds?


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>