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?
相关问题
- npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs
- google-drive can't get push notifications
- How to reimport module with ES6 import
- Date with SimpleDateFormat in Java
- Why is `node.js` dying when called from inside pyt
相关文章
- node连接远程oracle报错
- How can make folder with Firebase Cloud Functions
- @angular-cli install fails with deprecated request
- node.js modify file data stream?
- How to resolve hostname to an ip address in node j
- MYSQL: How can I find 'last monday's date&
- Calculate number of working days in a month [dupli
- Transactionally writing files in Node.js
add the class .post-date to a tag holding the date
I found a solution 1.Create a function in pug using - syntax 2.pass the varible to the function when pug.js is binding variables to the pug template
This is old, but I do the following:
Returns a date 'mm/dd/yyyy' format, in no additional libs required.
I actually started using date-util which is 2 parts both clientside and server side.
URL https://github.com/JerrySievert/node-date-utils
Using within a Browser
Using with Node.js
Note: This did not work in the REPL before Node.js 0.6 due to how Node.js handles context in the REPL.
Static Methods
Instance Methods
Or you could use the moment.js library to handle dates and format them accordingly to your needs
You can use moment.js
First, add moment to your express application locals
Then you can use moment within a jade template like this:
Moment takes
Date.now()
by default, so yo can also write:Sources: