var dateFormat = require('dateformat'); and then just format your stuff: var myYYYYmmddDate = dateformat(new Date(), 'yyyy-mm-dd')
script>. Now dateformat is MM/DD/YY .how to change the date format to YYYY-MM-DD.
The following example shows how you can do this for the dd/mm/yyyy format.
The output is of string type.Is there any way to convert string to date object with the dd/MM/yyyy format and output after format change is of date type and not of string