How to convert datetime to string in python in django -


I have a datetime object on my model. I'm sending it to the scene, but in the html I do not know what to write to format it.

I'm trying

  {{item.date .strftime ("% Y-% m-% d"). Part}}  

but I get

  TemplateSyntaxError: some characters could not be parsed: Item.date.strftime | ("% Y-% m-% d") || Saved  

When I'm just using

  {{items .date | Escape}}  

This is working, but now I want to format with

any suggestions?

Try using the built-in Django instead:

  {{Item.date | Date: "Ym D"}}  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -