admin管理员组文章数量:1390334
I have got a Python Flask app that will get data from API and pass it to html template.
On html template I have following and I would like to convert the "insertionTime" from Unix timestamp to human readable format.
<div class="results">
{% if results %}
<h2>Results:</h2>
<ul>
{% for result in results %}
<li><strong>{{ result['id'] }}</strong><br>{{ result['insertionTime'] }}<br>{{ result['eventType'] }}<br>{{ result['activity'] }}</li>
<hr>
{% endfor %}
</ul>
{% else %}
<p>No results found.</p>
{% endif %}
</div>
I have added flask_moment and changed to the following but it throws AttributeError: 'int' object has no attribute '_render'
<br>{{ moment.unix(result['insertionTime']).format(LLL) }}<br>
Any help would be much appreciated, thank you.
本文标签: datetimeConvert Unix timestamp returned from API in Python Flask appStack Overflow
版权声明:本文标题:datetime - Convert Unix timestamp returned from API in Python Flask app - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744645430a2617374.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论