Display timestamp in django template

前端 未结 5 1104
太阳男子
太阳男子 2020-12-16 13:26

I need to display timestamp of a post with in django template. The timestamp would be like:

\"timestamp\":1337453263939 in milli seconds

I

5条回答
  •  无人及你
    2020-12-16 14:02

    {% now "U" %}
    

    The "U" is a date format for Unix epoch, and can also be used with built-in date filter. So, if you have the date in a variable:

    {{ value|date:"U" }}
    

提交回复
热议问题