1、
from flask.ext.moment import Moment
moment = Moment(app)
2、
templates/base.html
{% block scripts %}
{{ super() }}
{{ moment.include_moment() }}
{% endblock %}
3、
from datetime import datetime
@app.route('/')
def index():
return render_template('index.html',current_time=datetime.utcnow())
4、
<p>The local date and time is {{ moment(current_time).format('LLL') }}.</p>
<p>That was {{ moment(current_time).fromNow(refresh=True) }}</p>
5
moment.js
format()
formatNow()
fromTime()
calendar()
valueOf()
unix()