95๐
โ
Try using built-in django template tags and filters:
https://docs.djangoproject.com/en/stable/ref/templates/builtins/#now
Examples:
It is {% now "jS F Y H:i" %}
It is {% now "SHORT_DATETIME_FORMAT" %}
๐คSara
0๐
The full list of datetime formats can be found in the docs. Using the format options there, you can construct the current datetime in whatever format you want. For example,
It is {% now "l, F j, Y g:i A" %}.
displays
It is Wednesday, September 27, 2023 11:58 PM.
on the webpage, and
It is {% now "" %}.
It is {% now "N j, Y" %}.
both display
It is Sept. 28, 2023.
๐คcottontail
- [Django]-Django select only rows with duplicate field values
- [Django]-Django โ How to specify which field a validation fails on?
- [Django]-Django โ Login with Email
Source:stackexchange.com