直接時間のうち、新たな日は、私たちの習慣を満たしていない、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秒で