I am new to Node.js and Jade and I have tried to use #{Date.now()}
and it\'s giving me numbers. How do I display the date in mm/dd/yy
format?
First, add moment to your express application locals
express = require('express');
...
app = express();
app.locals.moment = require('moment');
Then you can use moment within a jade template like this:
p #{moment(Date.now()).format('MM/DD/YYYY')}
Moment takes Date.now()
by default, so yo can also write:
p #{moment().format('MM/DD/YYYY')}
Sources: