DAILY DOCDAILY DOC
Rust
Node
Notes
Ubuntu
Leetcode
  • it-tools
  • excalidraw
  • linux-command
Rust
Node
Notes
Ubuntu
Leetcode
  • it-tools
  • excalidraw
  • linux-command
  • node

    • NODE
    • parseArgs
    • compose
    • date-format
    • dayjs
    • encrypt
    • env-cmd
    • glob
    • Koa 洋葱模型
    • lodash
    • logger
    • log4js
    • mongod
    • nanoid
    • node-red
    • node-stream
    • node:test
    • nodemailer
    • nodemon
    • nodered
    • parse-curl
    • pm2
    • toml
    • ws
    • yargs
    • zx

date-format

node 时间格式化

npm install date-format
var format = require('date-format');
format(); //defaults to ISO8601 format and current date.
format(new Date());
format('hh:mm:ss.SSS', new Date());
format('yyyy-MM-dd hh:mm:ss.SSS', new Date());
dd - date.getDate()
MM - date.getMonth() + 1
yy - date.getFullYear().toString().substring(2, 4)
yyyy - date.getFullYear()
hh - date.getHours()
mm - date.getMinutes()
ss - date.getSeconds()
SSS - date.getMilliseconds()

Refer

  • npm date-format
Last Updated:
Contributors: rosendo
Prev
compose
Next
dayjs