node package manager
Love JavaScript? Your insights can make it even better. Take the 2017 JavaScript Ecosystem Survey »

yyyy-mm-dd

yyyy-mm-dd

Formats a Date as yyyy-MM-dd.

Usage

$ npm install yyyy-mm-dd
(...)
$ node
> let yyyymmdd = require('yyyy-mm-dd')
undefined
> yyyymmdd()
'2015-04-29'
> yyyymmdd.withTime()
'2015-04-29 16:51:09'
> yyyymmdd(new Date(1999, 0, 1))
'1999-01-01'