刚开始学习flask,请问如何使用flask-moment中的format来解析时间?
我在view.py中通过render_template('index.html', current_time=datetime.now()) 把当前时间传入index.html.
在 {{current_time}}index.html中:显示时间为:2015-08-25 16:41:44.175112
现在用 {{ moment(current_time).format('MM-DD-YYYY HH:mm:ss') }} {{ moment(current_time).format('YYYY-MM-DD HH:mm:ss') }}和解析时间,但是都显示为:2015-08-25T16:48:55Z,这说明format没有起到作用?
请问正确的解析方式该是什么,谢谢!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
如图,写法并没有什么错,然而你那是后端的模版引擎吧?你先确认能直接执行 Javascript 函数再说……
py 又不是node 哈哈