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?

  1. date
  2. now
  3. datetime
  4. 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

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.