I get date data from an API on the internet, but it comes as a string. How do I convert this to the following format using django HTML template tag?
Current date data format: 2022-02-13 00:00:00 UTC
My wish format: 13 February 2022 00:00
My wish another format: 13 February 2022
Because in templates it's not that simple to use Python, we need to create custom Template Tag. Let's start with creating folder in your app, let's name it custom_tags.py. It should be created in
YourProject/your_app/templatetags/folder, so we have to also create templatetags folder in there.custom_tags.py:
your_template.html:
If you can get
datetimeobjects directly you can usedatetag in templates.usage:
Read more in Django DOCS