Node.jsのイベント処理プラグインはDATEFORMATを使用します

直接時間のうち、新たな日は、私たちの習慣を満たしていない、dateformarプラグNode.jsのは、多くの場合、以下を使用し、時間を扱うことができて
1件のダウンロードDATEFORMATはプラグNPMインストールDATEFORMAT
JSに導入された2 DATEFORMATモジュール
3変数のインポートモジュールを

const template=require('art-template');
const path=require('path');
const dateformat=require('dateformat');
const views=path.join(__dirname,'view','06.art');
//导入模板变量,使处理函数是template里的一个方法
template.defaults.imports.dateformat=dateformat;
const html=template(views,{
    time:new Date(),
})
console.log(html);

4 .artでテンプレートを使用します

{{dateformat(time,'yyyy-mm-dd HH:MM:ss')}}

その結果、2019年10月7日夜01時40分53秒で

公開された17元の記事 ウォンの賞賛0 ビュー426

おすすめ

転載: blog.csdn.net/weixin_44805161/article/details/102303049