How to display current year in Flask template?

前端 未结 3 673
暗喜
暗喜 2021-02-07 06:09

I am looking to find out how to output the current year in a Flask template. I know in Django you can use {% now \"Y\" %}., but is there a Flask equivalent? I have

3条回答
  •  离开以前
    2021-02-07 06:53

    For moment there is Flask Moment. It is powerful like Moment, and easy to use in Flask. To display the year in the user's local time from your Jinja template:

    The current year is: {{ moment().format('YYYY') }}.

提交回复
热议问题