I want to convert my timestamp to datetime in jinja2..
here's my sample code:
import time
date = time.time()
self.tv['date'] = date
sample html:
<p>{{ date }}</p>
I want to convert it to datetime using jinja2 in python..
thanks..
Make a custom filter like
@app.template_filter('ctime')
def timectime(s):
return time.ctime(s) # datetime.datetime.fromtimestamp(s)
And use your template filter
{{ date | ctime }}