Home »
Python »
Django MCQs
Which Django tag is used to insert the current date and time?
35. Which Django tag is used to insert the current date and time?
- date
- now
- datetime
- currentdatetime
Answer: B) now
Explanation:
The Django tag now is used to insert the current date and/or time. Consider the below syntax –
{% now format %}
Example:
<h1>{% now "Y-m-d" %}</h1>
Output:
2023-07-17