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
Post a Comment